You are here

public function ViewEditForm::buildOptionForm in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/views_ui/src/ViewEditForm.php \Drupal\views_ui\ViewEditForm::buildOptionForm()

Build a renderable array representing one option on the edit form.

This function might be more logical as a method on an object, if a suitable object emerges out of refactoring.

1 call to ViewEditForm::buildOptionForm()
ViewEditForm::getDisplayDetails in core/modules/views_ui/src/ViewEditForm.php
Helper function to get the display details section of the edit UI.

File

core/modules/views_ui/src/ViewEditForm.php, line 883
Contains \Drupal\views_ui\ViewEditForm.

Class

ViewEditForm
Form controller for the Views edit form.

Namespace

Drupal\views_ui

Code

public function buildOptionForm(ViewUI $view, $id, $option, $display) {
  $option_build = array();
  $option_build['#theme'] = 'views_ui_display_tab_setting';
  $option_build['#description'] = $option['title'];
  $option_build['#link'] = $view
    ->getExecutable()->displayHandlers
    ->get($display['id'])
    ->optionLink($option['value'], $id, '', empty($option['desc']) ? '' : $option['desc']);
  $option_build['#links'] = array();
  if (!empty($option['links']) && is_array($option['links'])) {
    foreach ($option['links'] as $link_id => $link_value) {
      $option_build['#settings_links'][] = $view
        ->getExecutable()->displayHandlers
        ->get($display['id'])
        ->optionLink($option['setting'], $link_id, 'views-button-configure', $link_value);
    }
  }
  if (!empty($view
    ->getExecutable()->displayHandlers
    ->get($display['id'])->options['defaults'][$id])) {
    $display_id = 'default';
    $option_build['#defaulted'] = TRUE;
  }
  else {
    $display_id = $display['id'];
    if (!$view
      ->getExecutable()->displayHandlers
      ->get($display['id'])
      ->isDefaultDisplay()) {
      if ($view
        ->getExecutable()->displayHandlers
        ->get($display['id'])
        ->defaultableSections($id)) {
        $option_build['#overridden'] = TRUE;
      }
    }
  }
  $option_build['#attributes']['class'][] = Html::cleanCssIdentifier($display_id . '-' . $id);
  return $option_build;
}