1
|
<?php
|
2
|
|
3
|
/**
|
4
|
* @file
|
5
|
* Definition of views_plugin_argument_default_node.
|
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
|
|
15
|
/**
|
16
|
* {@inheritdoc}
|
17
|
*/
|
18
|
public function get_argument() {
|
19
|
foreach (range(1, 3) as $i) {
|
20
|
$node = menu_get_object('node', $i);
|
21
|
if (!empty($node)) {
|
22
|
return $node->nid;
|
23
|
}
|
24
|
}
|
25
|
|
26
|
if (arg(0) == 'node' && is_numeric(arg(1))) {
|
27
|
return arg(1);
|
28
|
}
|
29
|
}
|
30
|
|
31
|
}
|