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.
Problem/Motivation
Custom modules that implements the hook_quicktabs_tabstyles() and have a space in their name create invalid and useless CSS classes.
Example: How to repeat
function myproject_styles_quicktabs_tabstyles() {
$tabstyles_directory = drupal_get_path('module', 'myproject_styles') . '/tabstyles';
return array($tabstyles_directory . '/myproject-blue.css' => t('My Project Blue'));
}
The HTML output from quicktabs creates an invalid classname for this style: "quicktabs-style-my project blue".
<div id="quicktabs-myproject_test" class="quicktabs-wrapper quicktabs-style-my project blue jquery-once-1-processed">
<div class="item-list">
<ul class="quicktabs-tabs quicktabs-style-my project blue">...</ul>
</div>
<div id="quicktabs-container-myproject_test" class="quicktabs_main quicktabs-style-my project blue">...</div>
</div>
Proposed resolution
Instead of using drupal_strtolower()
to create the class name, use drupal_html_class()
.
...Patch provided in first comment.
Comment | File | Size | Author |
---|---|---|---|
#2 | quicktabs-invalid-style-classnames-1759330-2.patch | 1.73 KB | jwilson3 |
#1 | quicktabs-invalid-style-classnames-1759330.patch | 1.36 KB | jwilson3 |
Comments
Comment #1
jwilson3Comment #2
jwilson3Rerolled. I missed one instance of the invalid classname. should be applicable with git apply now.
Comment #3
ezra-g CreditAttribution: ezra-g commentedLooks good - Thanks!
http://drupalcode.org/project/quicktabs.git/commit/0788eba
Comment #4.0
(not verified) CreditAttribution: commentedClarify problem statement section.