~spreadubuntu/spreadubuntu/devel-drupal6

« back to all changes in this revision

Viewing changes to sites/all/modules/views/modules/node/views_plugin_argument_default_node.inc

  • Committer: ruben
  • Date: 2009-06-08 09:38:49 UTC
  • Revision ID: ruben@captive-20090608093849-s1qtsyctv2vwp1x1
SpreadUbuntu moving to Drupal6. Based on ubuntu-drupal theme and adding our modules

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
// $Id: views_plugin_argument_default_node.inc,v 1.1 2008/09/03 19:21:29 merlinofchaos Exp $
 
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
class views_plugin_argument_default_node extends views_plugin_argument_default {
 
12
  function argument_form(&$form, &$form_state) {
 
13
  }
 
14
 
 
15
  function get_argument() {
 
16
    foreach (range(1, 3) as $i) {
 
17
      $node = menu_get_object('node', $i);
 
18
      if (!empty($node)) {
 
19
        return $node->nid;
 
20
      }
 
21
    }
 
22
 
 
23
    if (arg(0) == 'node' && is_numeric(arg(1))) {
 
24
      return arg(1);
 
25
    }
 
26
  }
 
27
}
 
28