function simplify_form_alter in Simplify 7.2
Same name and namespace in other branches
- 8 simplify.module \simplify_form_alter()
Implements hook_form_alter().
File
- ./
simplify.module, line 57 - Simplifies the admin interface.
Code
function simplify_form_alter(&$form, &$form_state, $form_id) {
global $user;
switch ($form_id) {
case '_node_form' == drupal_substr($form_id, -10):
// All nodes forms
// Check role to hide items, but never show for administrator
if (1 != $user->uid && user_access('simplify node hide settings')) {
$node_types = node_type_get_types();
// Add general node to list of node types (all nodes)
array_push($node_types, array(
'type' => 'node',
));
foreach ($node_types as $key => $value) {
$value = (array) $value;
if (str_replace('_node_form', '', $form_id) == $value['type'] || 'node' == $value['type']) {
simplify_form_alter_unset($form, (array) $value);
}
}
}
}
}