The following form component tree (two levels):
2 level component tree
Is not formatted correctly at the Included email values section:
included email values
This happens because the number of indentation marks for all children is always 1. And the reason of this is that the regular expression that removes the hyphens of each children component removes them in a single replacement. This is done at includes/webform.components.inc at :

$indents = 0;
$label = preg_replace('/^([\-])+/', '', $label, -1, $indents);

In the above line, if $label is "--Textfield", $indents will not get a value of 2, but a value of 1 as the hyphens are all matched as a single group.

A patch is being attached in the next comment.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

juampynr’s picture

Title: "Included email values" components are indexed just one level » "Included email values" component tree is not being indented correctly when there is more than one level
FileSize
746 bytes

Patch that fixes this issue. I could not find a way with a regular expression that replaces hyphens one by one so the replacement count gets a correct value. That is why I am comparing the length of $label with itself after being truncated.

juampynr’s picture

Status: Active » Needs review

Changed status to needs review

quicksketch’s picture

Status: Needs review » Fixed

Thanks juampy. I finally had a chance to review this patch and it looks great. You were spot-on with why the current approach fails. I committed this patch but removed the last "-1" parameter, since preg_replace() defaults to -1 for the $limit parameter already.

juampynr’s picture

Great news.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.