class ElementProcessor in Cookie Content Blocker 8
Class ElementProcessor.
@package Drupal\cookie_content_blocker\ElementProcessor
Hierarchy
- class \Drupal\cookie_content_blocker\ElementProcessor\ElementProcessorBase implements ElementProcessorInterface, TrustedCallbackInterface
- class \Drupal\cookie_content_blocker\ElementProcessor\ElementProcessor
Expanded class hierarchy of ElementProcessor
1 string reference to 'ElementProcessor'
1 service uses ElementProcessor
File
- src/
ElementProcessor/ ElementProcessor.php, line 12
Namespace
Drupal\cookie_content_blocker\ElementProcessorView source
class ElementProcessor extends ElementProcessorBase {
/**
* The processor list.
*
* @var \Drupal\cookie_content_blocker\ElementProcessorInterface[]
*/
protected $processors = [];
/**
* {@inheritdoc}
*/
public function addProcessor(ElementProcessorInterface $processor) : void {
$this->processors[] = $processor;
}
/**
* {@inheritdoc}
*/
public function processElement(array $element) : array {
if (!$this
->applies($element)) {
return $element;
}
foreach ($this->processors as $processor) {
if (!$processor
->applies($element)) {
continue;
}
$element = $processor
->processElement($element);
}
return $element;
}
/**
* {@inheritdoc}
*/
public function applies(array $element) : bool {
return !empty($element['#cookie_content_blocker']);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ElementProcessor:: |
protected | property | The processor list. | |
ElementProcessor:: |
public | function | ||
ElementProcessor:: |
public | function |
Declares if the route processor applies to the given element. Overrides ElementProcessorBase:: |
|
ElementProcessor:: |
public | function |
Processes the element. Overrides ElementProcessorBase:: |
|
ElementProcessorBase:: |
public static | function |
Lists the trusted callbacks provided by the implementing class. Overrides TrustedCallbackInterface:: |
|
TrustedCallbackInterface:: |
constant | Untrusted callbacks throw exceptions. | ||
TrustedCallbackInterface:: |
constant | Untrusted callbacks trigger silenced E_USER_DEPRECATION errors. | ||
TrustedCallbackInterface:: |
constant | Untrusted callbacks trigger E_USER_WARNING errors. |