You are here

function lightning_layout_block_alter in Lightning Layout 8

Same name and namespace in other branches
  1. 8.2 lightning_layout.module \lightning_layout_block_alter()

Implements hook_block_alter().

File

./lightning_layout.module, line 67
Contains layout functionality for Lightning.

Code

function lightning_layout_block_alter(array &$blocks) {
  $allow = \Drupal::config('lightning_layout.settings')
    ->get('entity_blocks');

  // Suppress all entity_block derivatives for non-whitelisted entity types.
  $plugins = preg_grep('/^entity_block:/', array_keys($blocks));
  foreach ($plugins as $plugin_id) {
    if (!in_array(substr($plugin_id, 13), $allow)) {
      unset($blocks[$plugin_id]);
    }
  }
}