2

Is there a module that can list all the views installed on a system and their pages as well? If it can specify whether the Views are installed by modules or enduser created that will be helpful.

I am looking for something that create a list along this lines.

Name | Type of View | Page Name | Type of Page | Path

  • 2
    Views module lists views already, via Views UI. What's wrong with their native implementation? – Mołot Oct 14 '13 at 13:14
  • @Mołot I need to export the information into a content type or a database, and adjust it and export it as I see fit. I'd prefer a module that has such a view, like Views System which can be cloned and extended – vfclists Oct 14 '13 at 13:32
  • 1
    That's a very unusual request, I'd be quite surprised if anyone has written such a module (I can't imagine how it would be useful). Probably something you're going to have to write yourself to be honest – Clive Oct 14 '13 at 13:35
1

I don't think a module already exists for that.

To build it yourself, you'll need to implement hook_views_data(), and describe the views_view, and views_display tables.

These are the columns you'll have available from the views_view table:

  • name
  • description
  • tag
  • base_table
  • human_name
  • core

And from views_display:

  • vid (view id)
  • id
  • display_title
  • display_plugin
  • position
  • display_options

display_options is a serialised PHP array of data (containing the path and other specific information), so unless you implement some pretty advanced field/filters/etc handlers you won't be able to filter on those specific elements, or use them as fields.

  • Does this mean the info for the separate pages of a view are stored in the display_options field rather than in separate database rows? – vfclists Oct 14 '13 at 13:52
  • 1
    The displays themselves are each a row in the views_display table, but yeah, most of the useful data in there is in a serialised column (path, row style used, filters, etc) – Clive Oct 14 '13 at 13:53
  • I will accept it as it is as near an answer I'll get. I will delve into the Views module code later to see how the serialized info can be extracted – vfclists Oct 14 '13 at 15:41
  • 1
    Make sure you get the Advanced Help module installed for that; it's not exactly obvious, but there's a bunch of sample code for developing custom handlers buried in the Views section of that module. It's really useful, I'm not sure why they try so hard to hide it – Clive Oct 14 '13 at 15:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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