You are here

function views_ui_edit_form_get_build_from_option in Views (for Drupal 7) 7.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 views_ui_edit_form_get_build_from_option()
views_ui_get_display_tab_details in includes/admin.inc
Helper function to get the display details section of the edit UI.

File

includes/admin.inc, line 1879
Provides the Views' administrative interface.

Code

function views_ui_edit_form_get_build_from_option($id, $option, $view, $display) {
  $option_build = array();
  $option_build['#theme'] = 'views_ui_display_tab_setting';
  $option_build['#description'] = $option['title'];
  $option_build['#link'] = $display->handler
    ->option_link($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'][] = $display->handler
        ->option_link($option['setting'], $link_id, 'views-button-configure', $link_value);
    }
  }
  if (!empty($display->handler->options['defaults'][$id])) {
    $display_id = 'default';
    $option_build['#defaulted'] = TRUE;
  }
  else {
    $display_id = $display->id;
    if (!$display->handler
      ->is_default_display()) {
      if ($display->handler
        ->defaultable_sections($id)) {
        $option_build['#overridden'] = TRUE;
      }
    }
  }
  $option_build['#attributes']['class'][] = drupal_clean_css_identifier($display_id . '-' . $id);
  if (!empty($view->changed_sections[$display_id . '-' . $id])) {
    $option_build['#changed'] = TRUE;
  }
  return $option_build;
}