You are here

public function BlockFieldSelectionManager::getSelectionHandler in Block field 8

Returns an instance of BlockFieldSelectionInterface from $field.

Parameters

\Drupal\Core\Field\FieldDefinitionInterface $field: The 'block_field' field definition.

Return value

\Drupal\block_field\BlockFieldSelectionInterface The BlockFieldSelectionInterface instance.

Throws

\Drupal\Component\Plugin\Exception\PluginException

1 call to BlockFieldSelectionManager::getSelectionHandler()
BlockFieldSelectionManager::getWidgetOptions in src/BlockFieldSelectionManager.php
Returns an key => value array based on allowed referenceable blocks.

File

src/BlockFieldSelectionManager.php, line 59

Class

BlockFieldSelectionManager
Provides the Block field selection plugin manager.

Namespace

Drupal\block_field

Code

public function getSelectionHandler(FieldDefinitionInterface $field) {
  $settings = $field
    ->getSetting('selection_settings') ? $field
    ->getSetting('selection_settings') : [];
  return $this
    ->createInstance($field
    ->getSetting('selection'), $settings);
}