You are here

function _auto_image_style_formatter_settings_form_process_add_state in Auto image style 7

Helper function: set the proper #states to the use widget handlers.

1 string reference to '_auto_image_style_formatter_settings_form_process_add_state'
auto_image_style_field_formatter_settings_form in ./auto_image_style.module
Implements hook_field_formatter_settings_form().

File

./auto_image_style.module, line 105

Code

function _auto_image_style_formatter_settings_form_process_add_state($element, $form_state) {

  // Build a #parents based on the current checkbox.
  $target_parents = array_slice($element['#parents'], 0, -1);
  $target_parents[] = 'image_style_configure_css';
  $target_parents = array_shift($target_parents) . ($target_parents ? '[' . implode('][', $target_parents) . ']' : '');
  $element['#states']['visible'] = array(
    ':input[name="' . $target_parents . '"]' => array(
      'checked' => TRUE,
    ),
  );
  return $element;
}