home | career | drupal | java | mac | mysql | perl | php | scala | uml | unix

Drupal example source code file (admin_devel.module)

This example Drupal source code file (admin_devel.module) is included in the DevDaily.com "Drupal Source Code Warehouse" project. The intent of this project is to help you "Learn Drupal by Example".

PHP - Drupal tags/keywords

array, false, form_state, from, function, links, menu, paths, php, rebuilt, submit, system, type, value

The admin_devel.module Drupal example source code

<?php
// $Id: admin_devel.module,v 1.5 2011/01/06 23:32:08 sun Exp $

/**
 * @file
 * Administration and debugging functionality for developers and site builders.
 */

/**
 * Implements hook_form_FORMID_alter().
 */
function admin_devel_form_admin_menu_theme_settings_alter(&$form, &$form_state) {
  $form['actions']['wipe_rebuild'] = array(
    '#type' => 'submit',
    '#value' => t('Rebuild system links'),
    '#submit' => array('admin_devel_form_admin_menu_theme_settings_alter_rebuild_submit'),
    // @todo Not necessarily ready for mass-consumption yet.
    '#access' => FALSE,
  );
}

/**
 * Form submit handler to wipe and rebuild all 'module' = 'system' menu links.
 */
function admin_devel_form_admin_menu_theme_settings_alter_rebuild_submit($form, &$form_state) {
  // Delete all auto-generated menu links derived from menu router items.
  db_delete('menu_links')
    ->condition('module', 'system')
    ->execute();
  // Rebuild menu links from current menu router items.
  menu_rebuild();

  drupal_set_message(t('System links derived from menu router paths have been rebuilt.'));
}

Other Drupal examples (source code examples)

Here is a short list of links related to this Drupal admin_devel.module source code file:

new blog posts

"Drupal" is a registered trademark of Dries Buytaert.

my drupal tutorials and examples  

Copyright 1998-2016 Alvin Alexander, alvinalexander.com
All Rights Reserved.

Beginning in 2016, a portion of the proceeds from pages under the '/drupal-code-examples/' URI will be donated to charity.