1

I'd like to add a new setting to all fields in Views. In other words, when you click on any given field in the "Fields" list, you get a popup with the selected field's configuration options. I would like to add a new settings element here.

If this was just about adding a new setting to a specific custom field handler, then I would just create a new field handler class and have it extend views_handler_field. Then, I'd make my setting available by first defining it in option_definition() followed by adding a new form element in options_form(). However, I'd like the new setting to appear for all fields regardless of field handler.

What I've done so far is to simply provide an implementation of hook_form_views_ui_config_item_form_submit() to add the new setting. I'm adding my custom form element here as well as my own submit handler. In the submit handler I make sure to save the setting in $form_state['handler']->options in my submit handler.

However, is that the right way to go about it? Is there another way which Views facilitates and which would let me do things a little more clean so that I do not have to "mess" with the options array in my own submit handler, but rather have Views to actually know about my added universal field setting?

1 Answer 1

0

I wrote the module Views Label Tooltips based on my technique to achieve this, and here's a post explaining it: http://thereisamoduleforthat.com/content/recipe-extending-views-handlers-without-subclassing

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.