ViewEditForm::buildOptionForm

public ViewEditForm::buildOptionForm(ViewUI $view, $id, $option, $display)

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.

File

core/modules/views_ui/src/ViewEditForm.php, line 878

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;
}
doc_Drupal
2016-10-29 09:53:58
Comments
Leave a Comment

Please login to continue.