You are here

abstract class OperatorBase in ThemeKey 8

Hierarchy

Expanded class hierarchy of OperatorBase

2 files declare their use of OperatorBase
Equals.php in src/Plugin/Operator/Equals.php
Contains \Drupal\themekey\Plugin\Operator\Equals.
Lower.php in src/Plugin/Operator/Lower.php
Contains \Drupal\themekey\Plugin\Operator\Equals.

File

src/OperatorBase.php, line 14
Provides Drupal\themekey\OperatorBase.

Namespace

Drupal\themekey
View source
abstract class OperatorBase extends SingletonPluginBase implements OperatorInterface {
  public function getName() {
    return $this->pluginDefinition['name'];
  }
  public function getDescription() {
    return $this->pluginDefinition['description'];
  }

  /**
   * {@inheritdoc}
   */
  public function validate(PropertyAdminInterface $propertyAdmin, $value, FormStateInterface $form_state) {
    if ($possibleValues = $propertyAdmin
      ->getPossibleValues()) {
      if (!in_array($value, $possibleValues)) {
        $form_state
          ->setErrorByName('value', $this
          ->t('Value needs to be one of %values', implode(', ', $possibleValues)));
      }
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
OperatorBase::getDescription public function Return the Description of the ThemeKey operator. Overrides OperatorInterface::getDescription
OperatorBase::getName public function Return the name of the ThemeKey operator. Overrides OperatorInterface::getName
OperatorBase::validate public function Validate. Overrides OperatorInterface::validate
OperatorInterface::evaluate public function Return the Description of the ThemeKey operator. 2
PluginBase::$configuration protected property Configuration information passed into the plugin. 1
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
SingletonPluginBase::$instances protected static property
SingletonPluginBase::create public static function Creates an instance of the plugin. Overrides ContainerFactoryPluginInterface::create