Active
Project:
Menu Access
Version:
6.x-6.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
11 Jun 2011 at 09:33 UTC
Updated:
11 Jun 2011 at 09:33 UTC
One client wants to be able to edit the titles of the menu items, but I don't want them to mess up the structure or remove the items by accident. So I created a custom module for this. Maybe it could be integrated into Menu Access? If not, at least the maintainer could tell me the proper way to accomplish this, now I just needed to get something done quickly.
<?php
// $Id$
/**
* @file menu_control.module
* Hides extra menu settings from certain users.
*/
/* Custom permissions */
function menu_control_perm() {
return array('reorder menu', 'edit title', 'delete menu items');
}
function menu_control_form_alter(&$form, $form_state, $form_id) {
if (isset($form['#node']) && $form['#node']->type .'_node_form' == $form_id) {
if(!user_access('delete menu items')) {
unset($form['menu']['delete']);
}
if(!user_access('edit title')) {
unset($form['menu']['link_title']);
}
if(!user_access('reorder menu')) {
unset($form['menu']['parent']);
unset($form['menu']['weight']);
}
}
}
?>