Commit 3d50d733 authored by Helmut Hummel's avatar Helmut Hummel Committed by Nicole Cordes
Browse files

[BUGFIX] Abstract XSD generator can handle more than two namespace parts

The getTagNameForClass method in the abstract XSD generator class
could not handle class names with more than two namespace parts.

This caused e.g. TYPO3\CMS\Fluid\ViewHelpers\Be\Buttons\CshViewHelper to
not be transformed to "be.buttons.csh", but just "be.", which in turn
caused duplicate id errors in the resulting XSD document.

Make the code aware of more than two namespace parts.

Releases: master, 6.2
Resolves: #69463
Change-Id: I9a6a28b470679e7487f0d83a7ce9f267a1f3ec7f

Reviewed-by: Markus Klein's avatarMarkus Klein <>
Tested-by: Markus Klein's avatarMarkus Klein <>
Reviewed-by: Nicole Cordes's avatarNicole Cordes <>
Tested-by: Nicole Cordes's avatarNicole Cordes <>
parent 81ad545e
......@@ -78,15 +78,18 @@ abstract class AbstractGenerator {
* @return string Tag name
protected function getTagNameForClass($className, $namespace) {
$strippedClassName = substr($className, strlen($namespace));
/// Strip namespace from the beginning and "ViewHelper" from the end of the class name
$strippedClassName = substr($className, strlen($namespace), -10);
$classNameParts = explode(\TYPO3\CMS\Fluid\Fluid::NAMESPACE_SEPARATOR, $strippedClassName);
if (count($classNameParts) == 1) {
$tagName = lcfirst(substr($classNameParts[0], 0, -10)); // strip the "ViewHelper" ending
} else {
$tagName = lcfirst($classNameParts[0]) . '.' . lcfirst(substr($classNameParts[1], 0, -10));
return $tagName;
return implode(
function($element) {
return lcfirst($element);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment