Projet

Général

Profil

Paste
Télécharger (573 octets) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / views / modules / node / views_plugin_argument_default_node.inc @ 13755f8d

1
<?php
2

    
3
/**
4
 * @file
5
 * Contains the node from URL argument default plugin.
6
 */
7

    
8
/**
9
 * Default argument plugin to extract a node via menu_get_object
10
 *
11
 * This plugin actually has no options so it odes not need to do a great deal.
12
 */
13
class views_plugin_argument_default_node extends views_plugin_argument_default {
14
  function get_argument() {
15
    foreach (range(1, 3) as $i) {
16
      $node = menu_get_object('node', $i);
17
      if (!empty($node)) {
18
        return $node->nid;
19
      }
20
    }
21

    
22
    if (arg(0) == 'node' && is_numeric(arg(1))) {
23
      return arg(1);
24
    }
25
  }
26
}