You are here

abstract class StyleBase in Styles API 8

Provides a base class for Styles plugins.

Hierarchy

Expanded class hierarchy of StyleBase

File

src/Plugin/Style/StyleBase.php, line 17
Contains \Drupal\styles_api\Plugin\Layout\StyleBase.

Namespace

Drupal\styles_api\Plugin\Style
View source
abstract class StyleBase extends PluginBase implements StyleInterface {

  /**
   * @var array
   * The style configuration.
   */
  protected $configuration = [];

  /**
   * Get the plugin's description.
   *
   * @return string
   *   The style description
   */
  public function getDescription() {
    return $this->pluginDefinition['description'];
  }

  /**
   * Get the base path for all resources.
   *
   * @return string
   *   The full base to all resources.
   */
  public function getLabel() {
    return isset($this->pluginDefinition['label']) && $this->pluginDefinition['label'] ? $this->pluginDefinition['label'] : FALSE;
  }

  /**
   * Get the full path to the icon image.
   *
   * This can optionally be used in the user interface to show the layout of
   * regions visually.
   *
   * @return string
   *   The full path to preview image file.
   */
  public function getIconFilename() {
    return isset($this->pluginDefinition['icon']) && $this->pluginDefinition['icon'] ? $this->pluginDefinition['icon'] : FALSE;
  }

  /**
   * Get the configuration for theme template.
   *
   * @return string
   *   Theme function name.
   */
  public function getConfiguration() {
    return isset($this->pluginDefinition['configuration']) && $this->pluginDefinition['configuration'] ? $this->pluginDefinition['configuration'] : FALSE;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ConfigurablePluginInterface::defaultConfiguration public function Gets default configuration for this plugin. 1
ConfigurablePluginInterface::setConfiguration public function Sets the configuration for this plugin instance. 1
DependencySerializationTrait::$_entityStorages protected property An array of entity type IDs keyed by the property name of their storages.
DependencySerializationTrait::$_serviceIds protected property An array of service IDs keyed by property name used for serialization.
DependencySerializationTrait::__sleep public function 1
DependencySerializationTrait::__wakeup public function 2
DependentPluginInterface::calculateDependencies public function Calculates dependencies for the configured plugin. 19
MessengerTrait::$messenger protected property The messenger. 29
MessengerTrait::messenger public function Gets the messenger. 29
MessengerTrait::setMessenger public function Sets the messenger.
PluginBase::$pluginDefinition protected property The plugin implementation definition. 1
PluginBase::$pluginId protected property The plugin_id.
PluginBase::DERIVATIVE_SEPARATOR constant A string which is used to separate base plugin IDs from the derivative ID.
PluginBase::getBaseId public function Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface::getBaseId
PluginBase::getDerivativeId public function Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface::getDerivativeId
PluginBase::getPluginDefinition public function Gets the definition of the plugin implementation. Overrides PluginInspectionInterface::getPluginDefinition 3
PluginBase::getPluginId public function Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface::getPluginId
PluginBase::isConfigurable public function Determines if the plugin is configurable.
PluginBase::__construct public function Constructs a \Drupal\Component\Plugin\PluginBase object. 92
PluginFormInterface::buildConfigurationForm public function Form constructor. 36
PluginFormInterface::submitConfigurationForm public function Form submission handler. 32
PluginFormInterface::validateConfigurationForm public function Form validation handler. 18
StringTranslationTrait::$stringTranslation protected property The string translation service. 1
StringTranslationTrait::formatPlural protected function Formats a string containing a count of items.
StringTranslationTrait::getNumberOfPlurals protected function Returns the number of plurals supported by a given language.
StringTranslationTrait::getStringTranslation protected function Gets the string translation service.
StringTranslationTrait::setStringTranslation public function Sets the string translation service to use. 2
StringTranslationTrait::t protected function Translates a string to the current language or to a given language.
StyleBase::$configuration protected property The style configuration. Overrides PluginBase::$configuration
StyleBase::getConfiguration public function Get the configuration for theme template. Overrides ConfigurablePluginInterface::getConfiguration
StyleBase::getDescription public function Get the plugin's description.
StyleBase::getIconFilename public function Get the full path to the icon image.
StyleBase::getLabel public function Get the base path for all resources.