function menu_position_edit_rule in Menu Position 7.2
Same name and namespace in other branches
- 6 menu_position.admin.inc \menu_position_edit_rule()
- 7 menu_position.admin.inc \menu_position_edit_rule()
Edits a menu position rule.
Parameters
$rule: An associate array defining the rule to be edited. Must contain the following keys:
- rid: The rule ID.
- admin_title: The administrative title of the rule.
- conditions: An associative array whose keys are the machine names of the plugins actively configured in the rule. The value of each array element is array containing the necessary variables for that plugin.
- menu_name: The machine name of the menu where this rule is positioned.
- plid: The mlid of the parent menu link specified in the rule.
1 call to menu_position_edit_rule()
- menu_position_rule_form_submit in ./
menu_position.admin.inc - Handles form submission for menu_position_rule_form().
File
- ./
menu_position.admin.inc, line 550 - Provides infrequently used functions and hooks for menu_position.
Code
function menu_position_edit_rule($rule) {
$fields = array(
'admin_title' => $rule['admin_title'],
'conditions' => serialize($rule['conditions']),
'menu_name' => $rule['menu_name'],
'plid' => $rule['plid'],
);
// Update the rule.
db_update('menu_position_rules')
->condition('rid', $rule['rid'])
->fields($fields)
->execute();
// Update the link.
$mlid = db_query('SELECT mlid FROM {menu_position_rules} WHERE rid = :rid', array(
':rid' => $rule['rid'],
))
->fetchField();
menu_position_edit_menu_link($rule['rid'], $mlid, $rule['plid'], $rule['admin_title']);
}