Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Extension Base Class

Jannik Zschiesche edited this page Jul 30, 2013 · 3 revisions

The PHP class file of every extension must inherit from Prism_Detached_Extension_Base, which is an abstract class and provides an interface for all extensions. The general structure of the interface is:

<?php

/**
* The base class for all extensions
*/
abstract class Prism_Detached_Extension_Base
{
    /**
     * The chosen theme
     *
     * @var string
     */
    protected $theme;


    abstract public function getSortOrder ();
    abstract public function getName ();
    abstract public function getDesc ();
    public function getJavascript () { /* ... */ }
    public function getCss () { /* ... */ }
}
  • (string) $theme: contains the name of the chosen theme (currently one of the following: "prism" / "prism-dark" / "prism-funky")
  • (int|float) getSortOrder(): Should return a number, indicating the relative (ascending) ordering. (Some extensions need to iterate over all defined languages, they should get a higher order value than language definitions)
  • (string) getName(): returns the display name of the extension
  • (string) getDesc(): returns the description of the extension
  • (string[]) getJavascript(): returns an array of the relative paths (relative to the extension directory) to the JavaScript files
  • (string[]) getCss(): returns an array of the relative paths (relative to the extension directory) to the CSS files

Core Extension Order Values:

  • 50: Autolinker Plugin
  • 50: Line Highlight Plugin
  • 50: Show Invisibles Plugin
  • 60: IE8 Plugin
  • 60: WebPlatform Docs
Clone this wiki locally