nodeblock.views.inc 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. /**
  3. * @file
  4. * Provides the views data and handlers for nodeblock.module.
  5. */
  6. /**
  7. * Implements hook_views_data().
  8. */
  9. function nodeblock_views_data() {
  10. $data = array();
  11. // Define the {nodeblock} table.
  12. $data['nodeblock']['table']['group'] = t('Node Block');
  13. // We can use this as a base table for Views.
  14. $data['nodeblock']['table']['base'] = array(
  15. 'field' => 'nodeblock',
  16. 'title' => t('Node Block'),
  17. 'help' => t('Node Block turns nodes into blocks.'),
  18. );
  19. // Define the joins.
  20. $data['nodeblock']['table']['join']['node'] = array(
  21. 'left_field' => 'nid',
  22. 'field' => 'nid',
  23. );
  24. // Define the fields.
  25. $data['nodeblock']['block_title'] = array(
  26. 'title' => t('Block title'),
  27. 'help' => t('The block title for this node.'),
  28. 'field' => array(
  29. 'click sortable' => TRUE,
  30. ),
  31. // Information for accepting a block title as a filter
  32. 'filter' => array(
  33. 'handler' => 'views_handler_filter_string',
  34. ),
  35. // Information for sorting on a title.
  36. 'sort' => array(
  37. 'handler' => 'views_handler_sort',
  38. ),
  39. );
  40. $data['nodeblock']['enabled'] = array(
  41. 'title' => t('Block available'),
  42. 'help' => t('Whether the node is available as block.'),
  43. 'field' => array(
  44. 'click sortable' => TRUE,
  45. ),
  46. 'field' => array(
  47. 'handler' => 'views_handler_field_boolean',
  48. 'click sortable' => TRUE,
  49. 'output formats' => array(
  50. 'yes-no' => array(t('Available'), t('Unavailable')),
  51. ),
  52. ),
  53. 'filter' => array(
  54. 'handler' => 'views_handler_filter_boolean_operator',
  55. 'label' => t('Available as node block'),
  56. 'type' => 'yes-no',
  57. ),
  58. );
  59. return $data;
  60. }