You are here

public function PluginAlter::alterBlocks in Block Blacklist [Deprecated] 8

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 91

Class

PluginAlter
Implementation callbacks for plugin alter hooks.

Namespace

Drupal\block_blacklist

Code

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