Commit 0e116ff9 authored by webchick's avatar webchick
Browse files

#555142 by yched: Clean up unneeded menu-rebuild code in Field UI.

parent cc22ae66
......@@ -496,7 +496,6 @@ function field_ui_field_overview_form_submit($form, &$form_state) {
field_create_field($field);
field_create_instance($instance);
$destinations[] = $admin_path . '/fields/refresh';
$destinations[] = $admin_path . '/fields/' . $field['field_name'] . '/field-settings';
$destinations[] = $admin_path . '/fields/' . $field['field_name'] . '/edit';
......@@ -528,7 +527,6 @@ function field_ui_field_overview_form_submit($form, &$form_state) {
try {
field_create_instance($instance);
$destinations[] = $admin_path . '/fields/refresh';
$destinations[] = $admin_path . '/fields/' . $instance['field_name'] . '/edit';
// Store new field information for any additional submit handlers.
$form_state['fields_added']['_add_existing_field'] = $instance['field_name'];
......@@ -999,11 +997,7 @@ function field_ui_field_delete_form_submit($form, &$form_state) {
}
$admin_path = _field_ui_bundle_admin_path($bundle);
$destinations = array(
$admin_path . '/fields/refresh',
$admin_path . '/fields',
);
$form_state['redirect'] = field_ui_get_destinations($destinations);
$form_state['redirect'] = field_ui_get_destinations(array($admin_path . '/fields'));
}
/**
......@@ -1331,24 +1325,6 @@ function field_ui_next_destination($bundle) {
return $admin_path . '/fields';
}
/**
* Menu callback; rebuild the menu after adding new fields.
*
* Dummy function to force a page refresh so menu_rebuild() will work right
* when creating a new field that creates a new menu item.
*/
function field_ui_field_menu_refresh($obj_type, $bundle) {
$bundle = field_attach_extract_bundle($obj_type, $bundle);
menu_rebuild();
$destinations = field_ui_next_destination($bundle);
if (is_array($destinations)) {
$path = array_shift($destinations);
drupal_goto($path, $destinations);
}
drupal_goto($destinations);
}
/**
* Helper function to order fields when theming overview forms.
*/
......
......@@ -61,34 +61,6 @@ function field_ui_menu() {
'type' => MENU_LOCAL_TASK,
'weight' => 1,
) + $access;
// A dummy function to trigger a page refresh so that field menus get
// rebuilt correctly when new fields are added.
$items["$path/fields/refresh"] = array(
'title' => 'Refresh menu',
'page callback' => 'field_ui_field_menu_refresh',
'page arguments' => array($obj_type, $bundle_arg),
'type' => MENU_CALLBACK,
'weight' => 1,
) + $access;
$items["$path/display"] = array(
'title' => 'Display fields',
'page callback' => 'drupal_get_form',
'page arguments' => array('field_ui_display_overview_form', $obj_type, $bundle_arg),
'type' => MENU_LOCAL_TASK,
'weight' => 2,
) + $access;
// 'Display fields' tab and context secondary tabs.
$tabs = field_ui_build_modes_tabs($obj_type);
foreach ($tabs as $key => $tab) {
$items["$path/display/$key"] = array(
'title' => $tab['title'],
'page arguments' => array('field_ui_display_overview_form', $obj_type, $bundle_arg, $key),
'type' => $key == 'basic' ? MENU_DEFAULT_LOCAL_TASK : MENU_LOCAL_TASK,
'weight' => $key == 'basic' ? 0 : 1,
) + $access;
}
$instance_position = count(explode('/', $path)) + 1;
$items["$path/fields/%field_ui_menu"] = array(
'title callback' => 'field_ui_menu_label',
......@@ -126,6 +98,24 @@ function field_ui_menu() {
'page arguments' => array('field_ui_field_delete_form', $obj_type, $bundle_arg, $instance_position),
'type' => MENU_LOCAL_TASK,
) + $access;
// 'Display fields' tab and context secondary tabs.
$items["$path/display"] = array(
'title' => 'Display fields',
'page callback' => 'drupal_get_form',
'page arguments' => array('field_ui_display_overview_form', $obj_type, $bundle_arg),
'type' => MENU_LOCAL_TASK,
'weight' => 2,
) + $access;
$tabs = field_ui_build_modes_tabs($obj_type);
foreach ($tabs as $key => $tab) {
$items["$path/display/$key"] = array(
'title' => $tab['title'],
'page arguments' => array('field_ui_display_overview_form', $obj_type, $bundle_arg, $key),
'type' => $key == 'basic' ? MENU_DEFAULT_LOCAL_TASK : MENU_LOCAL_TASK,
'weight' => $key == 'basic' ? 0 : 1,
) + $access;
}
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment