views_plugin_argument_default_node.inc 573 B

1234567891011121314151617181920212223242526
  1. <?php
  2. /**
  3. * @file
  4. * Contains the node from URL argument default plugin.
  5. */
  6. /**
  7. * Default argument plugin to extract a node via menu_get_object
  8. *
  9. * This plugin actually has no options so it odes not need to do a great deal.
  10. */
  11. class views_plugin_argument_default_node extends views_plugin_argument_default {
  12. function get_argument() {
  13. foreach (range(1, 3) as $i) {
  14. $node = menu_get_object('node', $i);
  15. if (!empty($node)) {
  16. return $node->nid;
  17. }
  18. }
  19. if (arg(0) == 'node' && is_numeric(arg(1))) {
  20. return arg(1);
  21. }
  22. }
  23. }