Supplying a predefined list of options for an exposed item in a view in Drupal? -
I found a scene that filters by year. There is a normal text CCK field on year content type. I have highlighted this area in this view, so that the user could type a value for it. As with 2010, field sets will show all content types. My problem is, I do not want to type the user in the value. I want to convert that text field to a dropdown for several years.
My options are:
- Hack it with JQ -> Very bad
- Any other options?
My question is, how can I substitute 2, or worst situation, option 3?
When you edit the CCK field in Manage fields , you You can set the permission value for that area, if you do this, when you go back to View, you will have a new filter, allows the field - value Returns a selection menu of values allowed when shown.
If you do not want to limit prices during creation, then you need to change the highlighted form in the custom module:
function mymodule_form_alter (& amp; $ Form, $ Form_state, $ form_id) {if ($ form_id === 'views_exposed_form') {// Change your field name $ field_test_value ['field_test_value'] ['# type'] = 'Select'; $ Form ['field_test_value'] ['# Option'] = Array ('' => 2010, '2010', '2009' = 'gt;' 200 '); }}
See what you can do to see it.
Comments
Post a Comment