menu_edit_menu_form
modules/menu/menu.module, строка 303
- Версии
- 5
menu_edit_menu_form($type, $mid = 0)
Menu callback; handle the adding/editing of a new menu.
Код
<?php
function menu_edit_menu_form($type, $mid = 0) {
if ($type == 'edit') {
if (!($item = db_fetch_array(db_query('SELECT * FROM {menu} WHERE mid = %d', $mid)))) {
drupal_not_found();
return;
}
}
else {
$item = array('mid' => 0, 'pid' => 0, 'path' => '', 'weight' => 0, 'type' => MENU_CUSTOM_MENU);
}
$form['title'] = array('#type' => 'textfield',
'#title' => t('Title'),
'#default_value' => $item['title'],
'#description' => t('The name of the menu.'),
'#required' => TRUE,
);
$form['mid'] = array('#type' => 'value', '#value' => $item['mid']);
$form['pid'] = array('#type' => 'value', '#value' => $item['pid']);
$form['path'] = array('#type' => 'value', '#value' => $item['path']);
$form['weight'] = array('#type' => 'value', '#value' => $item['weight']);
$form['type'] = array('#type' => 'value', '#value' => $item['type']);
$form['submit'] = array('#type' => 'submit', '#value' => t('Submit'));
// Reuse the submit function of menu_edit_item_form.
$form['#base'] = 'menu_edit_item_form';
return $form;
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии