0

Is it possible to remove the description of views exposed filter widgets in other way as css display:none?

I tried to unset $widget->description, but without any success.

2
  • Leave the field blank? – VanD Jul 6 '15 at 21:55
  • It's a standard description. There's no field. Or I already didn't find it. – deelite Jul 6 '15 at 21:56
0

it can be done either via theme or custom module:

function MODULE_OR_THEME_form_alter(&$form, &$form_state, $form_id)
{
    if($form['#id'] == 'FORM_NAME')
    {
        $form['#info']['filter-FIELD_MACHINE_NAME']['label'] = '';
    }
}

use dpm($form); from the Devel Module to get the complete form name, and field names for non-content type filter criteria:

A suite of modules containing fun for module developers and themers ...

Devel Helper functions for Drupal developers and inquisitive admins. This module can print a summary of all database queries for each page request at the bottom of each page. The summary includes how many times each query was executed on a page (shouldn't run same query multiple times), and how long each query took (short is good - use cache for complex queries). Also a dprint_r($array) function is provided, which pretty prints arrays. Useful during development. Similarly, a ddebug_backtrace() is offerred.

Be aware that removing the label (description) will change the layout of the filter itself, so some css might be required to fix things.

1
  • Thank you! I didn't mean the label. I meant the description. I did a var_dump($variables) and got the syntax to the description. I got success with if($form['#id'] == 'views-exposed-form-model-overview-page') { $form['term_node_tid_depth']['#description'] = ''; }. – deelite Jul 7 '15 at 8:37
0

The question has already an answer, that is very technical, as it is supposed to be on this site.

Base-level developers, who find hard to dig through a ton of information like Drupal's dump($variables), can fulfill the 'impossible' task of removing the description from an exposed filter via the Better Exposed Filters module. https://www.drupal.org/node/766974

The module can tweak exposed filters in various ways. One is to override the description, so you may want to override the exposed filter's unwanted text with a blank space.

HTML in the override form gets interpreted, so you can enter the corresponding HTML entity. If a single blank space is still "too big", wrap it with a and style it to 1x1 pixel size.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.