Значение по умолчанию для раскрытых фильтров

  1. function MYMODULE_form_views_exposed_form_alter(&$form, &$form_state) {
  2. if (!isset($form_state['view']->exposed_input['<your_filter_field>'])) {
  3. // $form_state['view']->exposed_input only hold the value when you have applied any filter. Initially it doesn't hold any value. while $form_state['input'] hold the actual filter value to be applied.
  4. $form_state['input']['<filter_field>'] = '<default_value>';
  5. }
  6. }
Russian
Категория: 
The code has been tested and works
Мультитег: 

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.
Target Image