You are here

function editablefields_form_alter in Editable Fields 5

Same name and namespace in other branches
  1. 5.3 editablefields.module \editablefields_form_alter()
  2. 5.2 editablefields.module \editablefields_form_alter()
  3. 6.3 editablefields.module \editablefields_form_alter()

File

./editablefields.module, line 420

Code

function editablefields_form_alter($form_id, &$form) {
  foreach ($form as $key => $f) {
    if (preg_match('/^editablefieldsfiltervalue_(.*)$/', $key, $matches)) {
      $fieldname = $matches[1];
      foreach ($form[$fieldname] as $element => $val) {
        if (is_array($val) && is_array($val['#default_value'])) {
          $form[$fieldname][$element]['#default_value'] = $f['#value'];
        }
      }
    }
  }
}