You are here

protected function LayoutController::getList in Block Blacklist [Deprecated] 8

Create the list of block IDs.

Return value

array An array of block definitions.

Overrides DefaultController::getList

File

src/Controller/LayoutController.php, line 22

Class

LayoutController
Class DefaultController.

Namespace

Drupal\block_blacklist\Controller

Code

protected function getList() {
  $definitions = parent::getList();
  $settings = $this->configFactory
    ->get('block_blacklist.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')) : '',
  ];
  $this->blacklistService
    ->setUp($options);
  if ($this->blacklistService
    ->hasSettings()) {
    $callback = [
      $this->blacklistService,
      'blockIsAllowed',
    ];
    $definitions = array_filter($definitions, $callback, ARRAY_FILTER_USE_KEY);
  }
  return $definitions;
}