开发者

Set values for an exposed field in a block (in Drupal)?

开发者 https://www.devze.com 2022-12-11 15:37 出处:网络
I\'ve set up a view of \"properties\". One of the fields is \"price\". Now, i\'ve exposed price in a block, so that you can search for it from the block. The problem is that when you view the block, i

I've set up a view of "properties". One of the fields is "price". Now, i've exposed price in a block, so that you can search for it from the block. The problem is that when you view the block, i开发者_Python百科t shows the field as a box where you can enter a value. What I want is a dropdown, where you can select the following options:

  • < 1 million
  • < 2 million
  • < 3 million

Anyone know how to do that?


I believe you should be able to use hook_form_alter to change the field into a select field.


The problem is not that you want a select box, it's the level of specialization you want out of the exposed filter. Views can't see what it is you want as options, so it doesn't given you any.

If you wanted to make this functionality configurable from within views (instead of in the CCK Field settings), you would probably want to extend the Views Filter Pack.

However, your easiest option is hook_form_alter, unless the Textfield widget supports "Allowed Values", which I doubt.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号