public function Blocks::getReferenceableBlockDefinitions in Block field 8
Returns filtered block definitions based on plugin settings.
Return value
array An array of filtered block definitions.
Overrides BlockFieldSelectionInterface::getReferenceableBlockDefinitions
File
- src/
Plugin/ block_field/ BlockFieldSelection/ Blocks.php, line 99
Class
- Blocks
- Provides a 'categories' BlockFieldSection.
Namespace
Drupal\block_field\Plugin\block_field\BlockFieldSelectionCode
public function getReferenceableBlockDefinitions() {
$block_field_manager = \Drupal::service('block_field.manager');
$definitions = $block_field_manager
->getBlockDefinitions();
$values = !empty($this
->getConfiguration()['plugin_ids']) ? $this
->getConfiguration()['plugin_ids'] : array_keys($definitions);
$values = array_combine($values, $values);
return array_intersect_key($definitions, $values);
}