You are here

private function BlockContent::getBlockOptions in Quick Tabs 8.3

Get options for the block.

1 call to BlockContent::getBlockOptions()
BlockContent::optionsForm in src/Plugin/TabType/BlockContent.php
Return form elements used on the edit/add from.

File

src/Plugin/TabType/BlockContent.php, line 96

Class

BlockContent
Provides a 'block content' tab type.

Namespace

Drupal\quicktabs\Plugin\TabType

Code

private function getBlockOptions() {
  $block_manager = \Drupal::service('plugin.manager.block');
  $context_repository = \Drupal::service('context.repository');

  // Only add blocks which work without any available context.
  $definitions = $block_manager
    ->getDefinitionsForContexts($context_repository
    ->getAvailableContexts());

  // Order by category, and then by admin label.
  $definitions = $block_manager
    ->getSortedDefinitions($definitions);
  $blocks = [];
  foreach ($definitions as $block_id => $definition) {
    $blocks[$block_id] = $definition['admin_label'] . ' (' . $definition['provider'] . ')';
  }
  return $blocks;
}