The ctools_cleanstring() function is used in many places, including in Panelizer to filter the CSS class names that are added to the page body. The problem is that the default separator, a dash, is often used in pairs to separate between object types, e.g. "node--article". Provide an option in ctools_cleanstring() that allows multiple occurrences of the separator to be left as-is.

CommentFileSizeAuthor
#1 ctools-n2287399-1.patch1.45 KBdamienmckenna

Comments

damienmckenna’s picture

Status: Active » Needs review
StatusFileSize
new1.45 KB

This provides a new setting 'keep separators' that allows multiple separators to be kept as-is.

damienmckenna’s picture

FYI #2287353: Double dash css body class gets stripped no longer uses ctools_cleanstring().

njbarrett’s picture

I like this change, it's clean and only impacts you if you turn it on.

chris matthews’s picture

Issue tags: +Needs reroll

The 5 year old patch to leanstring.inc does not apply to the latest ctools 7.x-1.x-dev and if still applicable needs to be re-rolled.

Checking patch includes/cleanstring.inc...
Hunk #1 succeeded at 88 (offset -1 lines).
Hunk #2 succeeded at 106 (offset -1 lines).
error: while searching for:
    // Trim any leading or trailing separators (note the need to
    $output = preg_replace("/^$seppattern+|$seppattern+$/", '', $output);

    // Replace multiple separators with a single one
    $output = preg_replace("/$seppattern+/", $settings['separator'], $output);
  }

  // Enforce the maximum component length

error: patch failed: includes/cleanstring.inc:162
error: includes/cleanstring.inc: patch does not apply
japerry’s picture

Status: Needs review » Closed (outdated)

Drupal 7 is no longer supported, closing.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.