I have a view for my taxonomy terms. So all taxonomy terms end up overridden by this view. This view has an exposed form with filters. Everything works great, except for one single page/term, I want to remove one of the filter fields (color). On this one page, having an exposed filter for color makes no sense.

Now I don't know of any way to do this on the backend UI.

In a hook_form_alter function I have tried this...

	unset($form['#info']['filter-field_product_details_color_value']);
	unset($form['field_product_details_color_value']);

This removes it, but then I get an error...

Notice: Undefined index: field_product_details_color_value in views_handler_filter->accept_exposed_input() (line 547 of /home/websites/sites/client/public_html/sites/all/modules/views/handlers/views_handler_filter.inc).

So I'm at a loss. Assuming I keep this as one view, one display with arguments, as it is now, is there any way at all I can programmatically remove this single field in a proper way that makes Drupal, Views and me happy? Any help would be great.

Comments

dawehner’s picture

You could try something like

$form['field_product_details_color_value']['#type'] = 'hidden';

or #access = FALSE, which will both hide the field from the user.

xpersonas’s picture

Status: Active » Closed (fixed)

That worked. Thank you!