I have a View which displays content by taxonomy term from a particular vocabulary, and everything is going fine... except for one thing. I would like to display the Vocabulary description in the View header. I have succeeded in doing this by creating an attachment in the View which just does a select on the Vocabulary but this seems to me rather cumbersome and I wondered if there is a better way to do it.

Also, although I have succeeded in attaching my Attachment to the main Page in the View, I cannot see any way of controlling the order in which they appear. As it happens, things appear in the order I want but it seems to be more by accident than anything else.

2 Answers 2


An attachment is the cleanest way to do this using the Views Admin UI. Attachments can be re-ordered in the region they are placed in the parent view.

Another way to do this which requires code is to use hook_views_pre_view() and to create a blank Views Header Area in your views admin area -- then in code via hook_views_pre_view() set the content of that area using PHP to the description of your taxonomy term. But I would recommend trying to stick to the Views Admin for creating your views, as the more custom code you put in files/modules the harder your site is to maintain or change.

  • Thanks and I agree with your comment on avoiding special code. In fact I realised after I posted the question that once an attachment has been added to a page display, you can edit the attachment parameters so that it appears before the page display, after it, or both.
    – Martin K
    Commented Oct 14, 2014 at 9:35

  $vocabulary = taxonomy_get_vocabularies();
  $checklist_vocab_array = array(); /* Change to array('0' => '--none--'); if you want a none option*/
  foreach ($vocabulary as $item) {
  $key = $item->vid;
  $value = $item->name;
  $checklist_vocab_array[$key] = $value;

    '#type'             => 'checkboxes',
    '#title'            => t('List of current Vocabularies.'),
    '#position'         => 'left' ,
    '#options'          => $checklist_vocab_array ,
    '#default_value'    => variable_get('YOUR_MODULE_NAME_YOUR_FORM_NAME'),
    '#description'      => t('List of vocabularies displayed as checkboxes'),
     return system_settings_form($form);

for more information checkout this https://api.drupal.org/api/drupal/modules%21taxonomy%21taxonomy.module/function/taxonomy_get_vocabularies/7.x

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.