Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Find out what item corresponds to a specific path
<?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
You can’t perform that action at this time.