function views_handler_field::options_submit

3.x views_handler_field.inc views_handler_field::options_submit(&$form, &$form_state)

Performs some cleanup tasks on the options array before saving it.

Overrides views_handler::options_submit

File

handlers/views_handler_field.inc, line 450
@todo.

Class

views_handler_field
Base field handler that has no options and renders an unformatted field.

Code

function options_submit(&$form, &$form_state) {
  $options = &$form_state['values']['options'];
  $types = array('element_type', 'element_label_type', 'element_wrapper_type');
  $classes = array_combine(array('element_class', 'element_label_class', 'element_wrapper_class'), $types);

  foreach ($types as $type) {
    if (!$options[$type . '_enable']) {
      $options[$type] = '';
    }
  }

  foreach ($classes as $class => $type) {
    if (!$options[$class . '_enable'] || !$options[$type . '_enable']) {
      $options[$class] = '';
    }
  }

  if (empty($options['custom_label'])) {
    $options['label'] = '';
    $options['element_label_colon'] = FALSE;
  }
}