You are here

protected function ExtraFieldViewsPlugin::getViewDisplayOptions in Entity Extra Field 8

Same name and namespace in other branches
  1. 2.0.x src/Plugin/ExtraFieldType/ExtraFieldViewsPlugin.php \Drupal\entity_extra_field\Plugin\ExtraFieldType\ExtraFieldViewsPlugin::getViewDisplayOptions()

Get view display options.

Parameters

\Drupal\views\Entity\View $view: The view instance.

Return value

array An array of view display options.

1 call to ExtraFieldViewsPlugin::getViewDisplayOptions()
ExtraFieldViewsPlugin::buildConfigurationForm in src/Plugin/ExtraFieldType/ExtraFieldViewsPlugin.php
Form constructor.

File

src/Plugin/ExtraFieldType/ExtraFieldViewsPlugin.php, line 233

Class

ExtraFieldViewsPlugin
Define extra field views plugin.

Namespace

Drupal\entity_extra_field\Plugin\ExtraFieldType

Code

protected function getViewDisplayOptions(View $view) {
  $options = [];
  $exec = $view
    ->getExecutable();
  $exec
    ->initHandlers();

  /** @var \Drupal\views\Plugin\views\display\DisplayPluginInterface $display */
  foreach ($exec->displayHandlers
    ->getIterator() as $display_id => $display) {
    if (!isset($display->display) || !isset($display->display['display_title'])) {
      continue;
    }
    $options[$display_id] = $display->display['display_title'];
  }
  return $options;
}