You are here

function views_ui_setup_widget in Views (for Drupal 7) 5

Set up the dynamic #options on a widget

4 calls to views_ui_setup_widget()
views_ui_add_argument in ./views_ui.module
Add all the info for a single argument into the form.
views_ui_add_field in ./views_ui.module
Add all the info for a single field into the form.
views_ui_add_filter in ./views_ui.module
Add all the info for a single filter into the form.
views_ui_add_sort in ./views_ui.module
Add all the info for a single sort into the form.

File

./views_ui.module, line 746

Code

function views_ui_setup_widget($widget, $default_value, $argument = NULL) {
  if (!$argument) {
    $argument = $widget;
  }
  if (is_string($widget['#options']) && function_exists($widget['#options'])) {
    $widget['#options'] = $widget['#options']('option', $argument);
  }
  if ($widget['#multiple'] && is_array($widget['#options'])) {
    $widget['#size'] = min(count($widget['#options']), 8);
  }
  $widget['#default_value'] = $default_value;
  return $widget;
}