You are here

public function ViewUI::buildOptionForm in Views (for Drupal 7) 8.3

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 ViewUI::buildOptionForm()
ViewUI::getDisplayDetails in views_ui/lib/Drupal/views_ui/ViewUI.php
Helper function to get the display details section of the edit UI.

File

views_ui/lib/Drupal/views_ui/ViewUI.php, line 350
Definition of Drupal\views_ui\ViewUI.

Class

ViewUI
Stores UI related temporary settings.

Namespace

Drupal\views_ui

Code

public function buildOptionForm($id, $option, $display) {
  $option_build = array();
  $option_build['#theme'] = 'views_ui_display_tab_setting';
  $option_build['#description'] = $option['title'];
  $option_build['#link'] = $this->displayHandlers[$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'][] = $this->displayHandlers[$display['id']]
        ->optionLink($option['setting'], $link_id, 'views-button-configure', $link_value);
    }
  }
  if (!empty($this->displayHandlers[$display['id']]->options['defaults'][$id])) {
    $display_id = 'default';
    $option_build['#defaulted'] = TRUE;
  }
  else {
    $display_id = $display['id'];
    if (!$this->displayHandlers[$display['id']]
      ->isDefaultDisplay()) {
      if ($this->displayHandlers[$display['id']]
        ->defaultableSections($id)) {
        $option_build['#overridden'] = TRUE;
      }
    }
  }
  $option_build['#attributes']['class'][] = drupal_clean_css_identifier($display_id . '-' . $id);
  return $option_build;
}