function menu_patterns_params in Patterns 7
Same name and namespace in other branches
- 7.2 patterns_components/components/menu.inc \menu_patterns_params()
File
- patterns_components/
components/ menu.inc, line 270
Code
function menu_patterns_params($action, $form_id, &$data, &$a) {
switch ($form_id) {
case 'menu_edit_menu':
if ($action == PATTERNS_CREATE) {
$result = 'add';
}
elseif ($action == PATTERNS_MODIFY) {
$menu = menu_load($data['menu_name']);
$result = array(
'edit',
$menu,
);
}
break;
case 'menu_delete_menu_confirm':
$result = array(
menu_load($data['menu_name']),
);
break;
case 'menu_edit_item':
if ($action == PATTERNS_CREATE) {
$result = array(
'add',
NULL,
menu_load($data['menu_name']),
);
}
elseif ($action == PATTERNS_MODIFY) {
if (!isset($data['mlid'])) {
$mlid = db_query("SELECT mlid FROM {menu_links} WHERE menu_name = :menu and link_path=:path and link_title=:title", array(
'menu' => $data['menu_name_old'],
'path' => $data['link_path_old'],
'title' => $data['link_title_old'],
))
->fetchField();
}
$result = array(
'edit',
menu_link_load($mlid),
NULL,
);
}
break;
case 'menu_item_delete_form':
if (!isset($data['mlid'])) {
$mlid = db_query("SELECT mlid FROM {menu_links} WHERE menu_name = :menu and link_path=:path and link_title=:title", array(
'menu' => $data['menu_name'],
'path' => $data['link_path'],
'title' => $data['link_title'],
))
->fetchField();
}
$result = array(
menu_link_load($mlid),
);
break;
}
return patterns_results(PATTERNS_SUCCESS, t('Execution successful'), $result);
}