How to create a Views style plugin for Drupal?

I am trying to create a Views Style plugin for the Views module in Drupal. The purpose of the style plugin is to display the view as a drop-down list (i.e. SELECT).

I cannot for the whole life find suitable or complete documentation on how to do this. I looked at the source code of other Views style plugins, but that does not help.

Does anyone know how to do this or know any worthy documentation, manuals or tutorials on this?

+7
php plugins views drupal drupal-6
source share
1 answer

Not sure if the style element is what you are looking for: even if you could get the form element to render as proper HTML, the security of the form API would be hostile to any values ​​sent from that element.

(Form elements in Drupal have a double life: they exist as HTML s, but also in the form_state cache. Thus, any form element that is not explicitly displayed by the form API will be discarded when the form is submitted.)

A better solution if you are looking for form- #options elements would be to create a form using the normal form API and have views #options element's #options array.

The _nodereference_potential_references_views function from nodereference The CCK add-in has a similar function and is likely to be a good place to start. (It uses CCK hooks, so you cannot copy-paste directly in this case, but it should give you a pretty good idea of ​​what you need to do)

+1
source share

All Articles