Form alter强制暴露视图过滤器为fllow过滤器选项
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Form alter强制暴露视图过滤器为fllow过滤器选项相关的知识,希望对你有一定的参考价值。
callback in a form alter to enforce an exposed filter to use only the options set in filter. Works for selectlists only.
/** * Form alter hook Callbacks and helpers */ function _mymodule_formalter_exported_filter(&$form) { $filter_id = 'workflow_node.sid'; //set this to the id of the filter. use print_r($form['view'][#value']->filter) to find the ID foreach($form['view']['#value']->filter as $filter) { if ($filter['field'] == $filter_id) { $only_these = $filter['value']; break; } } foreach ($form['filter0']['#options'] as $key => $option) { $options[$key] = $option; } } $form['filter0']['#options'] = $options; $form['filter0']['#default_value'] = 40; //or any other value. } }
以上是关于Form alter强制暴露视图过滤器为fllow过滤器选项的主要内容,如果未能解决你的问题,请参考以下文章