Skip to content

Instantly share code, notes, and snippets.

@ThomasHambach
Created September 7, 2013 06:50
Show Gist options
  • Save ThomasHambach/6473409 to your computer and use it in GitHub Desktop.
Save ThomasHambach/6473409 to your computer and use it in GitHub Desktop.
Drupal 7, define header/footer/... for your view programatically.
<?php
/**
* Implements hook_views_data().
*/
function MYMODULE_views_data() {
$data = array();
$data[' MYMODULE__global']['table']['group'] = t('My Module');
$data[' MYMODULE__global']['table']['join'] = array(
'#global' => array(),
);
$data[' MYMODULE__global']['property'] = array(
'title' => t('My Module extras'),
'help' => t('Displays extra cats on your view!'),
'area' => array(
'handler' => 'MY_MODULE_views_handler_area_cats',
),
);
return $data;
}
/**
* @inheritdoc views_handler_area
*/
class MY_MODULE_views_handler_area_cats extends views_handler_area {
public function render($empty = FALSE) {
return theme('MY_MODULE_display_more_cats');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment