summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--devel.module28
-rw-r--r--devel.pages.inc35
2 files changed, 13 insertions, 50 deletions
diff --git a/devel.module b/devel.module
index 98a3c3b..f8637a2 100644
--- a/devel.module
+++ b/devel.module
@@ -219,7 +219,7 @@ function devel_menu() {
$items['node/%node/devel'] = array(
'title' => 'Devel',
'page callback' => 'devel_load_object',
- 'page arguments' => array(1, 'node'),
+ 'page arguments' => array('node', 1),
'access arguments' => array('access devel information'),
'type' => MENU_LOCAL_TASK,
'file' => 'devel.pages.inc',
@@ -227,10 +227,6 @@ function devel_menu() {
);
$items['node/%node/devel/load'] = array(
'title' => 'Load',
- 'page callback' => 'devel_load_object',
- 'page arguments' => array(1, 'node'),
- 'access arguments' => array('access devel information'),
- 'file' => 'devel.pages.inc',
'type' => MENU_DEFAULT_LOCAL_TASK,
);
$items['node/%node/devel/render'] = array(
@@ -245,7 +241,7 @@ function devel_menu() {
$items['comment/%comment/devel'] = array(
'title' => 'Devel',
'page callback' => 'devel_load_object',
- 'page arguments' => array(1, 'comment'),
+ 'page arguments' => array('comment', 1),
'access arguments' => array('access devel information'),
'type' => MENU_LOCAL_TASK,
'file' => 'devel.pages.inc',
@@ -253,11 +249,7 @@ function devel_menu() {
);
$items['comment/%comment/devel/load'] = array(
'title' => 'Load',
- 'page callback' => 'devel_load_object',
- 'page arguments' => array(1, 'comment'),
- 'access arguments' => array('access devel information'),
'type' => MENU_DEFAULT_LOCAL_TASK,
- 'file' => 'devel.pages.inc',
);
$items['comment/%comment/devel/render'] = array(
'title' => 'Render',
@@ -271,7 +263,7 @@ function devel_menu() {
$items['user/%user/devel'] = array(
'title' => 'Devel',
'page callback' => 'devel_load_object',
- 'page arguments' => array(1, 'user'),
+ 'page arguments' => array('user', 1),
'access arguments' => array('access devel information'),
'type' => MENU_LOCAL_TASK,
'file' => 'devel.pages.inc',
@@ -279,10 +271,6 @@ function devel_menu() {
);
$items['user/%user/devel/load'] = array(
'title' => 'Load',
- 'page callback' => 'devel_load_object',
- 'page arguments' => array(1, 'user'),
- 'access arguments' => array('access devel information'),
- 'file' => 'devel.pages.inc',
'type' => MENU_DEFAULT_LOCAL_TASK,
);
$items['user/%user/devel/render'] = array(
@@ -297,7 +285,7 @@ function devel_menu() {
$items['taxonomy/term/%taxonomy_term/devel'] = array(
'title' => 'Devel',
'page callback' => 'devel_load_object',
- 'page arguments' => array(2, 'term'),
+ 'page arguments' => array('taxonomy_term', 2, 'term'),
'access arguments' => array('access devel information'),
'file' => 'devel.pages.inc',
'type' => MENU_LOCAL_TASK,
@@ -305,16 +293,12 @@ function devel_menu() {
);
$items['taxonomy/term/%taxonomy_term/devel/load'] = array(
'title' => 'Load',
- 'page callback' => 'devel_load_object',
- 'page arguments' => array(2, 'term'),
- 'access arguments' => array('access devel information'),
- 'file' => 'devel.pages.inc',
'type' => MENU_DEFAULT_LOCAL_TASK,
);
$items['taxonomy/term/%taxonomy_term/devel/render'] = array(
'title' => 'Render',
- 'page callback' => 'devel_render_term',
- 'page arguments' => array(2),
+ 'page callback' => 'devel_render_object',
+ 'page arguments' => array('taxonomy_term', 2, 'term'),
'access arguments' => array('access devel information'),
'type' => MENU_LOCAL_TASK,
'file' => 'devel.pages.inc',
diff --git a/devel.pages.inc b/devel.pages.inc
index c949481..db3a436 100644
--- a/devel.pages.inc
+++ b/devel.pages.inc
@@ -333,42 +333,21 @@ function devel_session() {
}
/**
- * Menu callback; prints the render structure of a term.
- */
-function devel_render_term($term) {
- $build = array();
- $build += field_attach_view('taxonomy_term', $term);
- if (!empty($term->description)) {
- $build['term_description'] = array(
- '#markup' => filter_xss_admin($term->description),
- '#weight' => -1,
- '#prefix' => '<div class="taxonomy-term-description">',
- '#suffix' => '</div>',
- );
- }
- return kdevel_print_object($build, '$term->');
-}
-
-/**
* Menu callback; prints the loaded structure of the current node/user.
*/
-function devel_load_object($object, $name = NULL) {
- $title = isset($object->title) ? $object->title : $object->name;
- drupal_set_title($title);
+function devel_load_object($type, $object, $name = NULL) {
+ $name = isset($name) ? $name : $type;
return kdevel_print_object($object, '$'. $name .'->');
}
/**
* Menu callback; prints the render structure of the current object (currently node or user).
*/
-function devel_render_object($type, $object) {
- $output = '';
- $title = isset($object->title) ? $object->title : $object->name;
- // not sure why menu system doesn't give us a reasonable title here.
- drupal_set_title($title);
- $function = $type .'_build_content';
- $function($object);
- return kdevel_print_object($object->content, '$'. $type .'->');
+function devel_render_object($type, $object, $name = NULL) {
+ $name = isset($name) ? $name : $type;
+ $function = $type . '_view';
+ $build = $function($object);
+ return kdevel_print_object($build, '$'. $name .'->');
}
function devel_elements_page() {