class AttachedProcessor in Cookie Content Blocker 8
Class AttachedProcessor.
Processes attachments on blocked elements.
@package Drupal\cookie_content_blocker\ElementProcessor
Hierarchy
- class \Drupal\cookie_content_blocker\ElementProcessor\ElementProcessorBase implements ElementProcessorInterface, TrustedCallbackInterface
- class \Drupal\cookie_content_blocker\ElementProcessor\AttachedProcessor
Expanded class hierarchy of AttachedProcessor
1 string reference to 'AttachedProcessor'
1 service uses AttachedProcessor
File
- src/
ElementProcessor/ AttachedProcessor.php, line 14
Namespace
Drupal\cookie_content_blocker\ElementProcessorView source
class AttachedProcessor extends ElementProcessorBase {
/**
* The library manager.
*
* @var \Drupal\cookie_content_blocker\BlockedLibraryManagerInterface
*/
protected $libraryManager;
/**
* Constructs a AttachedProcessor object.
*
* @param \Drupal\cookie_content_blocker\BlockedLibraryManagerInterface $library_manager
* The library manager for blocked libraries.
*/
public function __construct(BlockedLibraryManagerInterface $library_manager) {
$this->libraryManager = $library_manager;
}
/**
* {@inheritdoc}
*/
public function applies(array $element) : bool {
return !empty($element['#attached']['library']);
}
/**
* {@inheritdoc}
*/
public function processElement(array $element) : array {
foreach ($element['#attached']['library'] as $library) {
$this->libraryManager
->addBlockedLibrary($library);
}
return $element;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
AttachedProcessor:: |
protected | property | The library manager. | |
AttachedProcessor:: |
public | function |
Declares if the route processor applies to the given element. Overrides ElementProcessorBase:: |
|
AttachedProcessor:: |
public | function |
Processes the element. Overrides ElementProcessorBase:: |
|
AttachedProcessor:: |
public | function | Constructs a AttachedProcessor object. | |
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. |