The current 7.x-3.16 branch was not working the way I expected. For readability, my field_tags are written with spaces (i.e. "my class") . When they are output as classes, the whitespace needs to be replaced with a non-whitespace character such as a hyphen. The author of this related thread (https://www.drupal.org/node/2752617) had an issue where multi-value fields were output as a single hyphenated class, and a solution was deployed in 7.x-3.16. Unfortunately, that solution will output tags containing whitespace with whitespace in tact, turning what should be one class into multiple classes. The solution in my patch handles both multi-value tags and tags containing whitespace.

If a single tag is made up of more than one word, separated by whitespace this patch will replace the whitespace with hyphens. If the tag is already hyphenated, it is left alone. If field_tags has multiple values, the get_row_class function pulls the value of the multi_type separator and inserts it into a preg_replace pattern. Multiple tags are preserved as multiple classes.

Members fund testing for the Drupal project. Drupal Association Learn more

Comments

drewble created an issue. See original summary.

drewble’s picture

drewble’s picture

Title: Update to 7.x-3.16 breaks displays using » Update to 7.x-3.16 breaks displays using field_tags as classes with spaces
nerdcore’s picture

Status: Active » Needs review

Status: Needs review » Needs work

The last submitted patch, 2: views-classes_with_spaces-2883728-1.patch, failed testing. View results

nerdcore’s picture

Status: Needs work » Needs review
FileSize
1.5 KB

I was unable to apply this patch. Not sure what code @drewble was working from but it seems to be neither 7.x-3.16 nor 7.x-3.x from git as of today...

Here is a re-roll of drewble's patch which should apply to 7.x-3.x-dev or 7.x-3.16.

Status: Needs review » Needs work

The last submitted patch, 6: views-classes_with_spaces-2883728-6.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.