abstract class ConditionCreatorBase in Block Visibility Groups 8
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements DerivativeInspectionInterface, PluginInspectionInterface
- class \Drupal\block_visibility_groups_admin\Plugin\ConditionCreatorBase implements ConditionCreatorInterface uses StringTranslationTrait
Expanded class hierarchy of ConditionCreatorBase
3 files declare their use of ConditionCreatorBase
- NodeTypeConditionCreator.php in block_visibility_groups_admin/
src/ Plugin/ ConditionCreator/ NodeTypeConditionCreator.php - RolesConditionCreator.php in block_visibility_groups_admin/
src/ Plugin/ ConditionCreator/ RolesConditionCreator.php - RouteConditionCreator.php in block_visibility_groups_admin/
src/ Plugin/ ConditionCreator/ RouteConditionCreator.php
File
- block_visibility_groups_admin/
src/ Plugin/ ConditionCreatorBase.php, line 11
Namespace
Drupal\block_visibility_groups_admin\PluginView source
abstract class ConditionCreatorBase extends PluginBase implements ConditionCreatorInterface {
use StringTranslationTrait;
/**
* @var \Drupal\Component\Plugin\PluginManagerInterface
*/
protected $pluginManager;
/**
* @var \Drupal\Core\Routing\CurrentRouteMatch
*/
protected $route;
/**
* RouteConditionCreator constructor.
*
* @param array $configuration
* @param string $plugin_id
* @param mixed $plugin_definition
*/
public function __construct($configuration, $plugin_id, $plugin_definition) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->route = $configuration['route'];
}
/**
* {@inheritdoc}
*/
public function createConditionConfig($plugin_info) {
$config = $plugin_info['condition_config'];
$config['id'] = isset($config['id']) ? $config['id'] : $this
->getPluginDefinition()['condition_plugin'];
$config['negate'] = isset($config['negate']) ? $config['negate'] : 0;
return $config;
}
/**
* {@inheritdoc}
*/
public function createConditionElements() {
$elements = [
'#tree' => TRUE,
'#type' => 'fieldset',
'#title' => $this
->getPluginDefinition()['label'],
'selected' => [
'#type' => 'checkbox',
'#title' => $this
->getNewConditionLabel(),
],
];
return $elements;
}
/**
* {@inheritdoc}
*/
public function itemSelected($condition_info) {
return !empty($condition_info['selected']);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ConditionCreatorBase:: |
protected | property | ||
ConditionCreatorBase:: |
protected | property | ||
ConditionCreatorBase:: |
public | function |
Create condition configuration from form submission. Overrides ConditionCreatorInterface:: |
2 |
ConditionCreatorBase:: |
public | function |
Create condition elements for form. Overrides ConditionCreatorInterface:: |
3 |
ConditionCreatorBase:: |
public | function |
Determine if a condition was selected in the form. Overrides ConditionCreatorInterface:: |
2 |
ConditionCreatorBase:: |
public | function |
RouteConditionCreator constructor. Overrides PluginBase:: |
1 |
ConditionCreatorInterface:: |
public | function | Get the label when creating a new condition. | 3 |
PluginBase:: |
protected | property | Configuration information passed into the plugin. | 1 |
PluginBase:: |
protected | property | The plugin implementation definition. | 1 |
PluginBase:: |
protected | property | The plugin_id. | |
PluginBase:: |
constant | A string which is used to separate base plugin IDs from the derivative ID. | ||
PluginBase:: |
public | function |
Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the definition of the plugin implementation. Overrides PluginInspectionInterface:: |
3 |
PluginBase:: |
public | function |
Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface:: |
|
PluginBase:: |
public | function | Determines if the plugin is configurable. | |
StringTranslationTrait:: |
protected | property | The string translation service. | 1 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. |