File tree Expand file tree Collapse file tree 2 files changed +29
-0
lines changed
app/code/Magento/Ui/view/base/web/js/form/element
lib/internal/Magento/Framework/Data/Form/Element Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ define([
20
20
return Abstract . extend ( {
21
21
defaults : {
22
22
elementSelector : 'textarea' ,
23
+ suffixRegExpPattern : '\\${ \\$.wysiwygUniqueSuffix }' ,
23
24
$wysiwygEditorButton : '' ,
24
25
links : {
25
26
value : '${ $.provider }:${ $.dataScope }'
@@ -60,6 +61,25 @@ define([
60
61
return this ;
61
62
} ,
62
63
64
+ /** @inheritdoc */
65
+ initConfig : function ( config ) {
66
+ var pattern = config . suffixRegExpPattern || this . constructor . defaults . suffixRegExpPattern ;
67
+
68
+ config . content = config . content . replace ( new RegExp ( pattern , 'g' ) , this . getUniqueSuffix ( config ) ) ;
69
+ this . _super ( ) ;
70
+
71
+ return this ;
72
+ } ,
73
+
74
+ /**
75
+ * Build unique id based on name, underscore separated.
76
+ *
77
+ * @param {Object } config
78
+ */
79
+ getUniqueSuffix : function ( config ) {
80
+ return config . name . replace ( / ( \. | - ) / g, '_' ) ;
81
+ } ,
82
+
63
83
/**
64
84
* @inheritdoc
65
85
*/
Original file line number Diff line number Diff line change @@ -542,4 +542,13 @@ protected function getInlineJs($jsSetupObject, $forceLoad)
542
542
</script> ' ;
543
543
return $ jsString ;
544
544
}
545
+
546
+ /**
547
+ * @inheritdoc
548
+ */
549
+ public function getHtmlId ()
550
+ {
551
+ $ suffix = $ this ->getConfig ('dynamic_id ' ) ? '${ $.wysiwygUniqueSuffix } ' : '' ;
552
+ return parent ::getHtmlId () . $ suffix ;
553
+ }
545
554
}
You can’t perform that action at this time.
0 commit comments