You are here

function admin_devel_form_admin_menu_theme_settings_alter in Administration menu 6.3

Same name and namespace in other branches
  1. 7.3 admin_devel/admin_devel.module \admin_devel_form_admin_menu_theme_settings_alter()

Implements hook_form_FORMID_alter().

File

admin_devel/admin_devel.module, line 18
Administration and debugging functionality for developers and site builders.

Code

function admin_devel_form_admin_menu_theme_settings_alter(&$form, &$form_state) {
  $form['admin_devel_rebuild'] = array(
    '#type' => 'fieldset',
    '#title' => t('Rebuild menu links'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#description' => t('Under unknown and hard to reproduce circumstances, Drupal\'s <a href="@issue-url">menu system fails to store menu links in their proper hierarchy</a>. In case links are either completely missing, appear multiple times or in displaced locations, you may try to <strong>delete all</strong> menu links and rebuild them from menu router information defined in enabled modules.<br /><br />Only menu links whose paths start with <code>admin*</code> will be deleted and rebuild.', array(
      '@issue-url' => url('http://drupal.org/node/550254'),
    )),
    '#tree' => TRUE,
    '#access' => user_access('administer site configuration'),
    // Purposively move at the end of the form, so the contained form button is
    // not the first in the form. Browsers trigger the first ("closest") submit
    // button when pressing ENTER after focusing a form input element.
    '#weight' => 1000,
  );
  $form['admin_devel_rebuild']['custom'] = array(
    '#type' => 'checkbox',
    '#title' => t('Include custom links'),
    '#return_value' => 1,
    '#default_value' => 0,
    '#description' => t('Additionally deletes any links that have been edited, customized, or manually created. <strong>All customizations and custom links will be lost, they cannot be rebuilt.</strong> Customizations to menu links are known to cause improper hierarchies.'),
  );
  $form['admin_devel_rebuild']['wipe_rebuild'] = array(
    '#type' => 'submit',
    '#value' => t('Delete and rebuild menu links'),
    '#submit' => array(
      'admin_devel_form_admin_menu_theme_settings_alter_rebuild_submit',
    ),
  );

  // system_settings_form_submit() workaround.
  $form['#validate'][] = 'admin_devel_form_admin_menu_theme_settings_alter_validate';
}