[Drupal] How to theme Drupal views table output of a view to add extra data to the view templates

| | 1 min read

In one of my project, I need to hack the existing view page for admin and need to style the page to show additional contents. Drupal have the feasibility to get the right template file from hook_theme suggestions to change the themes.

Follow the below steps to change your current views:

  • Go to view edit page and check on Theme information in advanced area.
  • Click on the theme information, you will get a pop-view describing the suggestions for your templates edits.
  • In the suggestions files, the template files which are in bold are ones which have been already used.
  • You can also get the theme suggestions for views from sites/all/modules/views/theme/
  • Now select a tpl.php file from the suggestions and copy on the admin theme folder.
  • Make changes to file and save the .tpl.php file.
  • Go to Configuration > Development > Performance > and clear all caches.
  • Now check the front page of view if the change affected on the page.
  • If no changes affected after edits:
    • Copy file name correctly from theme suggestions without any spaces.
    • Always check for the most specific suggestion hooks to make your edits rather checking for least.