Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi,
Having successfully learnt to theme views output, I turn my attention to input. How do you customize/theme an exposed filter? I have an exposed search: search terms filter, but the input box is too narrow for my liking. Is this a simple matter and, if so, how do I go about doing it?
Comments
Comment #1
merlinofchaos CreditAttribution: merlinofchaos commentedviews-exposed-form--viewname--displayname.tpl.php should work. Look in the 'theme' directory in the views module for the original template. You can also form_alter the form (views-exposed-form) as well.
Comment #2
edmunsta CreditAttribution: edmunsta commentedTheoretically, if I copy the original template entirely into the new template, should it display just as before? I have created views-exposed-form--myviewnamehere--page.tpl.php, and copied exactly the content of views-exposed-form.tpl.php. But when I put the new file into my theme folder, though the view output appears correctly, all the exposed filters have disappeared. A var_dump on $widget and $id both return NULL.
Comment #3
merlinofchaos CreditAttribution: merlinofchaos commentedOh, you're probably being hit by a core bug. Youll need to upgrade to Drupal 6.x-dev (There's a patch mentioned in the help file on the theme: Information section too; you can try that patch though it's now two patches and probably getting a little difficult to apply).
Comment #4
domesticat CreditAttribution: domesticat commentedPerforming a mass closing of all issues over 180 days old. Please reopen if needed.
Comment #5
doublejosh CreditAttribution: doublejosh commentedThis is technically how to get to theming the exposed filter form block area, but doesn't help you with the action form itself since it's already been built :(
Comment #6
Makku01 CreditAttribution: Makku01 commentedexcuse me but I have no idea how to name the template file for the block of a specific filter. the block ID is block-views-[VIEWNAME]-block_1. How do I have to name the tpl.php for the block? any advise is greatly appreciated! THX
Comment #7
doublejosh CreditAttribution: doublejosh commentedDon't believe it's possible to have template for a specific filter item. Only the full block.
That file would be:
views-exposed-form--MYVIEW--block-1.tpl.php
To mess with filters try a custom module. Here are two example of alterations I use. Hope that helps.