You are here

protected function LayoutController::getList in Block List Override 1.0.x

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_list_override\Controller

Code

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