Projet

Général

Profil

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

root / drupal7 / sites / all / modules / views / modules / book / views_plugin_argument_default_book_root.inc @ 5d12d676

1
<?php
2

    
3
/**
4
 * @file
5
 * Definition of views_plugin_argument_default_book_root.
6
 */
7

    
8
/**
9
 * Default argument plugin to get the current node's book root.
10
 */
11
class views_plugin_argument_default_book_root extends views_plugin_argument_default_node {
12

    
13
  /**
14
   * {@inheritdoc}
15
   */
16
  public function get_argument() {
17
    // Use the argument_default_node plugin to get the nid argument.
18
    $nid = parent::get_argument();
19
    if (!empty($nid)) {
20
      $node = node_load($nid);
21
      if (isset($node->book['bid'])) {
22
        return $node->book['bid'];
23
      }
24
    }
25
  }
26

    
27
}