Drupal – Add more content to a specific view using hook_views_pre_render

We can use the hook_views_pre_render to insert extra content before or after the view content.
custom.module

...
function custom_views_pre_render(&$view) {
  // Insert extra content for view named as test_exposed_filter_in_panel
  if ($view->name == "test_exposed_filter_in_panel") {
    $view->attachment_before = '<div>Visit <a href="http://www.ykyuen.com">Eureka!</div>';
    $view->attachment_after = '<div>Done =)</div>';
  }
}
...

 

Let’s see what we get now.

 

Done =)

Reference: Lullabot Drupal API Reference – hook_views_pre_render

2 thoughts on “Drupal – Add more content to a specific view using hook_views_pre_render”

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.