Projet

Général

Profil

Paste
Télécharger (1,07 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / ds / modules / ds_devel / ds_devel.module @ bf6fb0ee

1
<?php
2

    
3
/**
4
 * @file
5
 * Display Suite Devel
6
 */
7

    
8
/**
9
 * Implements hook_menu().
10
 */
11
function ds_devel_menu() {
12
  $items = array();
13

    
14
  $items['node/%node/devel/markup'] = array(
15
    'title' => 'Markup',
16
    'page callback' => 'ds_devel_render_object',
17
    'page arguments' => array('node', 1),
18
    'access arguments' => array('access devel information'),
19
    'type' => MENU_LOCAL_TASK,
20
    'weight' => 101,
21
  );
22

    
23
  return $items;
24
}
25

    
26
/**
27
 * Renders the markup of a node in HTML entities.
28
 */
29
function ds_devel_render_object($type, $node, $view_mode = 'full') {
30

    
31
  $build = node_view($node, $view_mode);
32
  $markup = drupal_render($build);
33

    
34
  $links = array();
35
  $links[] = l('Default', 'node/' . $node->nid . '/devel/markup/');
36
  $view_modes = ds_entity_view_modes('node');
37
  foreach ($view_modes as $key => $info) {
38
    if (!empty($info['custom settings'])) {
39
      $links[] = l($info['label'], 'node/' . $node->nid . '/devel/markup/' . $key);
40
    }
41
  }
42

    
43
  return array(
44
    '#markup' => '<div>' . implode(' - ', $links) . '</div><hr /><code><pre>' . check_plain($markup) . '</pre></code>'
45
  );
46
}