Created
November 28, 2017 11:13
-
-
Save opi/327717ed5750d6311aeb4abcf233c3e4 to your computer and use it in GitHub Desktop.
Drupal8 - Custom views exposed form suggestions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Implements hook_theme_suggestions_HOOK_alter(). | |
*/ | |
function MYTHEME_theme_suggestions_views_exposed_form_alter(array &$suggestions, array $vars) { | |
// form[#id] pattern is views-exposed-form-VIEWNAME-DISPLAY | |
// We need to remove the 'views-exposed-form-' part | |
// and to replace underscores with dashes | |
$suggestions[] = 'views_exposed_form__' . str_replace( | |
['views-exposed-form-', '-'], | |
['', '_'], | |
$vars['form']['#id']); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment