You are here

function properties_widget_remove_category in Dynamic properties 7

Submit callback to remove a category.

1 string reference to 'properties_widget_remove_category'
properties_field_widget_form in ./properties.module
Implements hook_field_widget_form().

File

./properties.module, line 691
This module provides a dynamic property field that can contain an unlimited number of attribute value pairs.

Code

function properties_widget_remove_category($form, &$form_state) {
  $field_name = $form_state['triggering_element']['#parents'][0];
  $langcode = $form[$field_name]['#language'];
  $values = $form_state['values'][$field_name][$langcode];

  // @todo: Verify that this always works.
  $category_name = $form_state['triggering_element']['#parents'][3];
  unset($form_state[$field_name]['categories'][$category_name]);
  $form_state['rebuild'] = TRUE;
}