function override_node_options_element_children_access in Override Node Options 5
Same name and namespace in other branches
- 6 override_node_options.module \override_node_options_element_children_access()
Check if there is a child element accessible in a parent element.
Parameters
$element: A form element.
Return value
TRUE if a child element of $element if accessible, or FALSE otherwise.
1 call to override_node_options_element_children_access()
- override_node_options_form_alter in ./
override_node_options.module - Implements hook_form_alter().
File
- ./
override_node_options.module, line 144 - Allow users to override the default publishing options for nodes they can edit without giving them the 'administer nodes' permission.
Code
function override_node_options_element_children_access($element) {
foreach (element_children($element) as $key) {
// Skip un-accessible children.
if (isset($element[$key]['#access']) && !$element[$key]['#access']) {
continue;
}
// Skip value and hidden elements, since they are not rendered.
if (isset($element[$key]['#type']) && in_array($element[$key]['#type'], array(
'value',
'hidden',
))) {
continue;
}
return TRUE;
}
return FALSE;
}