You are here

interface ShortcodeInterface in Shortcode 2.0.x

Same name and namespace in other branches
  1. 8 src/Plugin/ShortcodeInterface.php \Drupal\shortcode\Plugin\ShortcodeInterface

Defines the interface for text processing shortcode plugins.

Hierarchy

Expanded class hierarchy of ShortcodeInterface

All classes that implement ShortcodeInterface

See also

\Drupal\shortcode\Annotation\Shortcode

\Drupal\shortcode\ShortcodePluginManager

\Drupal\shortcode\Plugin\ShortcodeBase

Plugin API

File

src/Plugin/ShortcodeInterface.php, line 20

Namespace

Drupal\shortcode\Plugin
View source
interface ShortcodeInterface extends ConfigurableInterface, DependentPluginInterface, PluginInspectionInterface, ContainerFactoryPluginInterface {

  /**
   * Returns the administrative label for this shortcode plugin.
   *
   * @return string
   *   Administrative label.
   */
  public function getLabel();

  /**
   * Returns the administrative description for this shortcode plugin.
   *
   * @return string
   *   Administrative description.
   */
  public function getDescription();

  /**
   * Generates a shortcode's settings form.
   *
   * @param array $form
   *   A minimally pre-populated form array.
   * @param \Drupal\Core\Form\FormStateInterface $form_state
   *   The state of the (entire) configuration form.
   *
   * @return array
   *   The $form array with additional form elements for the settings of this
   *   filter. The submitted form values should match $this->settings.
   */
  public function settingsForm(array $form, FormStateInterface $form_state);

  /**
   * Performs the shortcode processing.
   *
   * @param array $attributes
   *   Array of attributes.
   * @param string $text
   *   The text string to be processed.
   * @param string $langcode
   *   The language code of the text to be filtered. Defaults to
   *   LANGCODE_NOT_SPECIFIED.
   *
   * @return string
   *   The processed text.
   */
  public function process(array $attributes, $text, $langcode = Language::LANGCODE_NOT_SPECIFIED);

  /**
   * Generates a filter's tip.
   *
   * A filter's tips should be informative and to the point. Short tips are
   * preferably one-liners.
   *
   * @param bool $long
   *   Whether this callback should return a short tip to display in a form
   *   (FALSE), or whether a more elaborate filter tips should be returned for
   *   template_preprocess_filter_tips() (TRUE).
   *
   * @return string|null
   *   Translated text to display as a tip, or NULL if this filter has no tip.
   *
   * @todo Split into getSummaryItem() and buildGuidelines().
   */
  public function tips($long = FALSE);

}

Members

Namesort descending Modifiers Type Description Overrides
ConfigurableInterface::defaultConfiguration public function Gets default configuration for this plugin. 14
ConfigurableInterface::getConfiguration public function Gets this plugin's configuration. 15
ConfigurableInterface::setConfiguration public function Sets the configuration for this plugin instance. 15
ContainerFactoryPluginInterface::create public static function Creates an instance of the plugin. 120
DependentPluginInterface::calculateDependencies public function Calculates dependencies for the configured plugin. 20
PluginInspectionInterface::getPluginDefinition public function Gets the definition of the plugin implementation. 4
PluginInspectionInterface::getPluginId public function Gets the plugin_id of the plugin instance. 2
ShortcodeInterface::getDescription public function Returns the administrative description for this shortcode plugin. 1
ShortcodeInterface::getLabel public function Returns the administrative label for this shortcode plugin. 1
ShortcodeInterface::process public function Performs the shortcode processing. 11
ShortcodeInterface::settingsForm public function Generates a shortcode's settings form. 1
ShortcodeInterface::tips public function Generates a filter's tip. 1