Programmatically adding field in footer VIEWS

Public
</> CopyGet raw version
php
  1. function hook_views_pre_view($view, &$display_id, &$args) {
  2. if ($view->name == 'my_view' && $display_id == 'my_display' ) {
  3. $footer = t('My custom text');
  4. $view->add_item('my_display', 'footer', 'views', 'area', array('content' => $footer, 'format' => 'full_html'));
  5. }
  6. }

Comments

kalabro's picture

Good to know. Thanks for sharing!
To modify existing “field” I usually use low level get_option/set_option functions:

  1. $pager = $view->display_handler->get_option('pager');
  2. $pager['options']['offset'] = 3;
  3. $view->display_handler->set_option('pager', $pager);