You are here

public function PluginAlter::alterBlocks in Block List Override 1.0.x

Alters block definitions.

Speeds up the system performance and the Layout Builder page by removing as many blocks as possible from the system, decreasing the number that it has to parse.

See also

hook_block_alter()

hook_plugin_filter_TYPE__CONSUMER_alter()

File

src/PluginAlter.php, line 92

Class

PluginAlter
Implementation callbacks for plugin alter hooks.

Namespace

Drupal\block_list_override

Code

public function alterBlocks(&$definitions) {
  if (!$this->listService
    ->hasSettings()) {
    return;
  }
  $callback = [
    $this->listService,
    'blockIsAllowed',
  ];
  $definitions = array_filter($definitions, $callback, ARRAY_FILTER_USE_KEY);
}