function flag_form_locked_process in Flag 7.3
Form process handler for locking flag properties.
Flags defined in code may define an array of properties in $flag->locked that are to be locked and may not be edited by the user.
1 string reference to 'flag_form_locked_process'
- flag_form in includes/
flag.admin.inc - Add/Edit flag page.
File
- includes/
flag.admin.inc, line 638 - Contains administrative pages for creating, editing, and deleting flags.
Code
function flag_form_locked_process($element, &$form_state, $form) {
$flag = $form['#flag'];
// Disable access to a form element whose name matches a locked flag property.
if (isset($element['#name']) && !empty($flag->locked[$element['#name']])) {
$element['#access'] = FALSE;
}
// Recurse into the form array.
foreach (element_children($element) as $key) {
// Workaround for Core inconvenience: setting #process here prevents an
// element's essential #process handlers from its hook_element_info()
// definition from being set in form_builder().
// @see http://drupal.org/node/1779496
if (isset($element[$key]['#type']) && ($info = element_info($element[$key]['#type']))) {
if (isset($info['#process'])) {
$element[$key]['#process'] = $info['#process'];
}
}
$element[$key]['#process'][] = 'flag_form_locked_process';
}
return $element;
}