You are here

function views_process_check_options in Views (for Drupal 7) 6.3

Same name and namespace in other branches
  1. 8.3 views.module \views_process_check_options()
  2. 6.2 includes/form.inc \views_process_check_options()
  3. 7.3 views.module \views_process_check_options()

#process callback to see if we need to check_plain() the options.

Since FAPI is inconsistent, the #options are sanitized for you in all cases _except_ checkboxes. We have form elements that are sometimes 'select' and sometimes 'checkboxes', so we need decide late in the form rendering cycle if the options need to be sanitized before they're rendered. This callback inspects the type, and if it's still 'checkboxes', does the sanitation.

1 string reference to 'views_process_check_options'
views_handler_filter_in_operator::value_form in handlers/views_handler_filter_in_operator.inc
Provide a form for setting options.

File

includes/form.inc, line 294
form.inc Views' replacements for Drupal's form functions.

Code

function views_process_check_options($element, $edit, &$form_state, &$form) {
  if ($element['#type'] == 'checkboxes' || $element['#type'] == 'checkbox') {
    $element['#options'] = array_map('check_plain', $element['#options']);
  }
  return $element;
}