You are here

function inline_conditions_field_widget_form_validate in Inline Conditions 7

Callback : Validate inline_conditions_field_widget_form.

Parameters

array $element: A form element array containing basic properties for the widget:

  • #entity_type: The name of the entity the field is attached to.
  • #bundle: The name of the field bundle the field is contained in.
  • #field_name: The name of the field.
  • #language: The language the field is being edited in.
  • #field_parents: The 'parents' space for the field in the form. Most widgets can simply overlook this property. This identifies the location where the field values are placed within $form_state['values'], and is used to access processing information for the field through the field_form_get_state() and field_form_set_state() functions.
  • #columns: A list of field storage columns of the field.
  • #title: The sanitized element label for the field instance, ready for output.
  • #description: The sanitized element description for the field instance, ready for output.
  • #required: A Boolean indicating whether the element value is required; for required multiple value fields, only the first widget's values are required.
  • #delta: The order of this item in the array of subelements; see $delta above.

array $form_state: An associative array containing the current state of the form.

array $form: The form structure where widgets are being attached to. This might be a full form structure, or a sub-element of a larger form.

1 string reference to 'inline_conditions_field_widget_form_validate'
inline_conditions_field_widget_form in ./inline_conditions.field.inc
Implements hook_field_widget_form().

File

./inline_conditions.field.inc, line 349
Field module functionality for the Inline Conditions module.

Code

function inline_conditions_field_widget_form_validate($element, &$form_state, $form) {

  // Remove action buttons values from the form state values.
  $value = drupal_array_get_nested_value($form_state['values'], $element['#parents']);
  $value = array_intersect_key($value, array_flip(array_filter(array_keys($value), 'is_numeric')));
  drupal_array_set_nested_value($form_state['values'], $element['#parents'], $value, TRUE);
}