@@ -652,7 +652,7 @@ private static function setVariablesToBreakpoints(array $attributes, array $vari
652652 )
653653 ) {
654654 // Merge data variables with the new variables array.
655- $ data [$ index ]['variable ' ] = \array_merge ($ item ['variable ' ], self ::variablesInner ($ variable , $ attributeValue , $ attributes ));
655+ $ data [$ index ]['variable ' ] = \array_merge ($ item ['variable ' ], self ::variablesInner ($ variable , $ attributeValue , $ attributes, $ manifest ));
656656 }
657657 }
658658 }
@@ -750,10 +750,11 @@ private static function prepareVariableData(array $globalBreakpoints): array
750750 * @param array<string, mixed> $variables Array of variables of CSS variables.
751751 * @param mixed $attributeValue Original attribute value used in magic variable.
752752 * @param array<string, mixed> $attributes Attributes that are read from component's/block's manifest.
753+ * @param array<string, mixed> $manifest Component/block manifest data.
753754 *
754755 * @return array<int, mixed>|string[]
755756 */
756- private static function variablesInner (array $ variables , $ attributeValue , array $ attributes ): array
757+ private static function variablesInner (array $ variables , $ attributeValue , array $ attributes, array $ manifest ): array
757758 {
758759 $ output = [];
759760
@@ -773,8 +774,14 @@ private static function variablesInner(array $variables, $attributeValue, array
773774 }
774775
775776 foreach ($ attributes as $ attrKey => $ attrValue ) {
776- if (\str_contains ($ variableValue , "%attr- {$ attrKey }% " )) {
777- $ variableValue = \str_replace ("%attr- {$ attrKey }% " , (string ) $ attrValue , $ variableValue );
777+ if (isset ($ attributes ['prefix ' ])) {
778+ $ key = (string )\str_replace ($ attributes ['prefix ' ], Helpers::kebabToCamelCase ($ manifest ['componentName ' ]), $ attrKey );
779+ } else {
780+ $ key = $ attrKey ;
781+ }
782+
783+ if (\str_contains ($ variableValue , "%attr- {$ key }% " )) {
784+ $ variableValue = \str_replace ("%attr- {$ key }% " , (string ) $ attrValue , $ variableValue );
778785 }
779786 }
780787
0 commit comments