If a user wants to hide an input filter, they probably have a good reason for doing so.
I don't think there's a good reason to only allow "standard" filters to be hidden.

The use case for me is Search API views exposed filters.
They're non-standard, so can't be hidden, even though I've implemented a customized search form to override views' exposed filters.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

AaronBauman’s picture

Status: Active » Needs review
FileSize
701 bytes
AaronBauman’s picture

Status: Needs review » Needs work

Doesn't work because of this clause, which I don't understand well enough to change.

      // These BEF options require a set of given options to work (namely,
      // $form[$field_id]['#options'] needs to set). But it is possilbe to
      // adjust settings elsewhere in the view that removes these options from
      // the form (eg: changing a taxonomy term filter from dropdown to
      // autocomplete). Check for that here and revert to Views' default filter
      // in those cases.
      $requires_options = array('bef', 'bef_ul', 'bef_links', 'bef_hidden');
      if (in_array($options['bef_format'], $requires_options) && empty($form[$field_id]['#options'])) {
        $options['bef_format'] = 'default';
      }
pinkonomy’s picture

Does this previous patch work?If not,can someone else help on this?

pinkonomy’s picture

@mikeker:Could you help on this please?
thanks

chertzog’s picture

Version: 7.x-3.x-dev » 8.x-3.x-dev
Issue summary: View changes
Status: Needs work » Needs review
FileSize
1.72 KB

Here is a patch against 8.x. I havent found any issues with it or reasons why hidden cant be applied to any element. It should be an easy backport to 7.x-3.x

chertzog’s picture

Looks like there are other issues in core surrounding "hidden" form fields. I needed this patch to make this work via ajax - https://www.drupal.org/project/drupal/issues/2313517.

So I dont know what the best solution here is, but the patch above in #5 along with the one in referenced issue makes this all work for me.

PapaGrande’s picture

@chertzog Can your patch be applied to BEF without the core patch and do no harm? Also, could you add tests?

chertzog’s picture

@PapaGrande i dont know, i havent done enough testing around it to confirm that. All i know is what was stated above. You would have to test it out yourself to verify no adverse effects. We use composer to manage patches which makes it easy to patch core as needed. I wish you luck.

Neslee Canil Pinto’s picture

Status: Needs review » Closed (won't fix)

We are trying to deprecate 8.x-3.x, can you please check whether this still exists in 8.x-4.x/8.x-5.x branch.