You are here

protected function EntityBrowserEditForm::getPluginDescription in Entity Browser 8

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

Get an introductory description to the one of the three plugin types.

Parameters

string $plugin_type: The plugin type.

Return value

array Markup render element.

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

File

src/Form/EntityBrowserEditForm.php, line 313

Class

EntityBrowserEditForm
Class EntityBrowserEditForm.

Namespace

Drupal\entity_browser\Form

Code

protected function getPluginDescription($plugin_type = '') {
  switch ($plugin_type) {
    case 'display':
      $intro = $this
        ->t('Choose here how the entity browser should be presented to the end user.');
      $definitions = $this->displayManager
        ->getDefinitions();
      break;
    case 'widget_selector':
      $intro = $this
        ->t('In the last step of the entity browser configuration you can decide how the widgets will be available to the editor.');
      $definitions = $this->widgetSelectorManager
        ->getDefinitions();
      break;
    case 'selection_display':
      $intro = $this
        ->t('You can optionally allow a "work-in-progress selection zone" to be available to the editor, while still navigating, browsing and selecting the entities.');
      $definitions = $this->selectionDisplayManager
        ->getDefinitions();
      break;
    default:
      return NULL;
  }
  $output = "<p>{$intro}</p>";
  $output .= '<p>' . $this
    ->t('The available plugins are:') . '</p>';
  $output .= '<dl>';
  foreach ($definitions as $plugin_id => $plugin_definition) {
    $output .= '<dt><strong>' . $plugin_definition['label'] . ':</strong></dt>';
    $output .= '<dd>' . $plugin_definition['description'] . '</dd>';
  }
  $output .= '</dl>';
  return [
    '#markup' => $output,
  ];
}