block_list_override.module in Block List Override 1.0.x
Contains block_list_override.module.
File
block_list_override.moduleView source
<?php
/**
* @file
* Contains block_list_override.module.
*/
/**
* Implements hook_block_alter().
*/
function block_list_override_block_alter(&$definitions) {
$listService = \Drupal::service('block_list_override.list');
$settings = \Drupal::config('block_list_override.settings');
$options = [
'match' => !empty($settings) ? trim($settings
->get('system_match')) : '',
'prefix' => !empty($settings) ? trim($settings
->get('system_prefix')) : '',
'regex' => !empty($settings) ? trim($settings
->get('system_regex')) : '',
'negate' => !empty($settings) ? $settings
->get('system_negate') : FALSE,
];
$listService
->setUp($options);
if (!$listService
->hasSettings()) {
return;
}
$callback = [
$listService,
'blockIsAllowed',
];
$definitions = array_filter($definitions, $callback, ARRAY_FILTER_USE_KEY);
}
/**z
* Implements hook_plugin_filter_TYPE__CONSUMER_alter().
*/
function block_list_override_plugin_filter_block__layout_builder_alter(&$definitions) {
$listService = \Drupal::service('block_list_override.list');
$settings = \Drupal::config('block_list_override.settings');
$options = [
'match' => !empty($settings) ? trim($settings
->get('layout_match')) : '',
'prefix' => !empty($settings) ? trim($settings
->get('layout_prefix')) : '',
'regex' => !empty($settings) ? trim($settings
->get('layout_regex')) : '',
'negate' => !empty($settings) ? $settings
->get('layout_negate') : FALSE,
];
$listService
->setUp($options);
if (!$listService
->hasSettings()) {
return;
}
$callback = [
$listService,
'blockIsAllowed',
];
$definitions = array_filter($definitions, $callback, ARRAY_FILTER_USE_KEY);
}
Functions
Name | Description |
---|---|
block_list_override_block_alter | Implements hook_block_alter(). |
block_list_override_plugin_filter_block__layout_builder_alter |