Created
July 29, 2014 22:19
-
-
Save mikeyp/8223aa8799b81b88a786 to your computer and use it in GitHub Desktop.
Find out what item corresponds to a specific path
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @file | |
* Provide Drush integration for finding menu router items. | |
*/ | |
/** | |
* Implements hook_drush_help(). | |
*/ | |
function path_audit_drush_help($section) { | |
switch ($section) { | |
case 'drush:path-audit': | |
return dt('Find the menu router item that matches a given path.'); | |
} | |
} | |
/** | |
* Implements hook_drush_command(). | |
*/ | |
function path_audit_drush_command() { | |
$items = array(); | |
$items['path-audit'] = array( | |
'description' => "Find the menu router item that matches a given path.", | |
'callback' => 'drush_path_audit', | |
'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_FULL, | |
'options' => array( | |
), | |
'examples' => array( | |
'drush path' => "", | |
), | |
'aliases' => array('path'), | |
); | |
return $items; | |
} | |
/** | |
* Return the menu path data.. | |
* | |
* Before calling this we need to be bootstrapped to DRUPAL_BOOTSTRAP_FULL. | |
*/ | |
function drush_path_audit($path) { | |
$router_item = menu_get_item($path); | |
$output = print_r($router_item); | |
return $output; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment