You are here

public function DefaultController::list in Block Blacklist [Deprecated] 8

List.

Return value

string Return list of all available block ids after processing.

1 string reference to 'DefaultController::list'
block_blacklist.routing.yml in ./block_blacklist.routing.yml
block_blacklist.routing.yml

File

src/Controller/DefaultController.php, line 86

Class

DefaultController
Class DefaultController.

Namespace

Drupal\block_blacklist\Controller

Code

public function list() {
  $definitions = $this
    ->getList();
  $header = [
    $this
      ->t('Module'),
    $this
      ->t('Label'),
    $this
      ->t('Block ID'),
  ];
  $rows = [];
  foreach ($definitions as $id => $definition) {
    $rows[] = [
      $definition['provider'],
      $definition['admin_label'],
      $id,
    ];
  }
  return [
    '#type' => 'table',
    '#caption' => $this
      ->getCaption(),
    '#header' => $header,
    '#rows' => $rows,
  ];
}