You are here

protected function EntityBrowserEditForm::getPluginOptions in Entity Browser 8.2

Same name and namespace in other branches
  1. 8 src/Form/EntityBrowserEditForm.php \Drupal\entity_browser\Form\EntityBrowserEditForm::getPluginOptions()

Get options for form element.

Return value

array Plugin options.

1 call to EntityBrowserEditForm::getPluginOptions()
EntityBrowserEditForm::form in src/Form/EntityBrowserEditForm.php
Gets the actual form array to be built.

File

src/Form/EntityBrowserEditForm.php, line 277

Class

EntityBrowserEditForm
Class EntityBrowserEditForm.

Namespace

Drupal\entity_browser\Form

Code

protected function getPluginOptions($plugin_type) {
  switch ($plugin_type) {
    case 'display':
      $definitions = $this->displayManager
        ->getDefinitions();
      break;
    case 'widget_selector':
      $definitions = $this->widgetSelectorManager
        ->getDefinitions();
      break;
    case 'selection_display':
      $definitions = $this->selectionDisplayManager
        ->getDefinitions();
      break;
    default:
      return [];
  }
  $options = [];
  foreach ($definitions as $plugin_id => $plugin_definition) {
    $options[$plugin_id] = $plugin_definition['label'];
  }
  return $options;
}