• Main Page
  • Related Pages
  • Modules
  • Classes
  • Files
  • File List
  • File Members

modules/book.views.inc

Go to the documentation of this file.
00001 <?php
00016 function book_views_data() {
00017   // ----------------------------------------------------------------------
00018   // book table
00019 
00020   $data['book']['table']['group']  = t('Book');
00021   $data['book']['table']['join'] = array(
00022     'node' => array(
00023       'left_field' => 'nid',
00024       'field' => 'nid',
00025     ),
00026   );
00027 
00028   $data['book']['bid'] = array(
00029     'title' => t('Top level book'),
00030     'help' => t('The book the node is in.'),
00031     'relationship' => array(
00032       'base' => 'node',
00033       'handler' => 'views_handler_relationship',
00034       'label' => t('Book'),
00035     ),
00036     // There is no argument here; if you need an argument, add the relationship
00037     // and use the node: nid argument.
00038   );
00039 
00040   // ----------------------------------------------------------------------
00041   // menu_links table -- this is aliased so we can get just book relations
00042 
00043   // Book hierarchy and weight data are now in {menu_links}.
00044   $data['book_menu_links']['table']['group'] = t('Book');
00045   $data['book_menu_links']['table']['join'] = array(
00046     'node' => array(
00047       'table' => 'menu_links',
00048       'left_table' => 'book',
00049       'left_field' => 'mlid',
00050       'field' => 'mlid',
00051     ),
00052   );
00053 
00054   $data['book_menu_links']['weight'] = array(
00055     'title' => t('Weight'),
00056     'help' => t('The weight of the book page.'),
00057     'field' => array(
00058       'handler' => 'views_handler_field_numeric',
00059       'click sortable' => TRUE,
00060     ),
00061     'sort' => array(
00062       'handler' => 'views_handler_sort',
00063     ),
00064   );
00065 
00066   $data['book_menu_links']['depth'] = array(
00067     'title' => t('Depth'),
00068     'help' => t('The depth of the book page in the hierarchy; top level books have a depth of 1.'),
00069     'field' => array(
00070       'handler' => 'views_handler_field_numeric',
00071       'click sortable' => TRUE,
00072     ),
00073     'sort' => array(
00074       'handler' => 'views_handler_sort',
00075     ),
00076     'filter' => array(
00077       'handler' => 'views_handler_filter_numeric',
00078     ),
00079     'argument' => array(
00080       'handler' => 'views_handler_argument',
00081     ),
00082   );
00083 
00084   $data['book_menu_links']['p'] = array(
00085     'title' => t('Hierarchy'),
00086     'help' => t('The order of pages in the book hierarchy.'),
00087     'sort' => array(
00088       'handler' => 'views_handler_sort_menu_hierarchy',
00089     ),
00090   );
00091 
00092   // ----------------------------------------------------------------------
00093   // book_parent table -- this is an alias of the book table which
00094   // represents the parent book.
00095 
00096   // The {book} record for the parent node.
00097   $data['book_parent']['table']['group'] = t('Book');
00098   $data['book_parent']['table']['join'] = array(
00099     'node' => array(
00100       'table' => 'book',
00101       'left_table' => 'book_menu_links',
00102       'left_field' => 'plid',
00103       'field' => 'mlid',
00104     ),
00105   );
00106 
00107   $data['book_parent']['nid'] = array(
00108     'title' => t('Parent'),
00109     'help' => t('The parent book node.'),
00110     'relationship' => array(
00111       'base' => 'node',
00112       'base field' => 'nid',
00113       'handler' => 'views_handler_relationship',
00114       'label' => t('Book parent'),
00115     ),
00116   );
00117 
00118   return $data;
00119 }
00120 

Generated on Sun Feb 26 2012 12:52:51 for Views by  doxygen 1.7.1