class AddJsClasses in Facets Block 8
AddJsClasses pre-render callback.
Hierarchy
- class \Drupal\facets_block\AddJsClasses implements TrustedCallbackInterface
Expanded class hierarchy of AddJsClasses
File
- src/
AddJsClasses.php, line 11
Namespace
Drupal\facets_blockView source
class AddJsClasses implements TrustedCallbackInterface {
/**
* {@inheritdoc}
*/
public static function trustedCallbacks() {
return [
'preRender',
];
}
/**
* Pre-render callback to add js classes to the facets_block block.
*/
public static function preRender($elements) {
$elements['#attributes']['class'][] = 'block-facets-ajax';
if (empty($elements['#id'])) {
$elements['#id'] = Html::getUniqueId($elements['#plugin_id']);
}
$elements['#attributes']['class'][] = "js-facet-block-id-{$elements['#id']}";
return $elements;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
AddJsClasses:: |
public static | function | Pre-render callback to add js classes to the facets_block block. | |
AddJsClasses:: |
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. |