File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ public function beforeSave(
5454 0
5555 )
5656 );
57- } else {
57+ } else if ( $ this -> moduleConfig -> useHtmlComments ()) {
5858 $ block ->setContent ('<!-- CMS identifier = ' . $ identifier . ' --> ' . "\n" . $ content );
5959 }
6060 }
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ class Config
1414{
1515 const XML_PATH_CMS_IDENTIFIER_MARKUP_ENABLED = 'cms/pagebuilder/block_identifier_markup_enabled ' ;
1616 const XML_PATH_CMS_IDENTIFIER_DATA_ATTR_NAME = 'cms/pagebuilder/block_identifier_attribute_name ' ;
17+ const XML_PATH_CMS_IDENTIFIER_HTML_COMMENT = 'cms/pagebuilder/block_identifier_comment ' ;
1718
1819 /** @var ScopeConfigInterface */
1920 private ScopeConfigInterface $ scopeConfig ;
@@ -52,4 +53,17 @@ public function getBlockIdentifierDataAttributeName($scopeCode = null): string
5253 $ scopeCode
5354 );
5455 }
56+
57+ /**
58+ * @param int|string|null $scopeCode
59+ * @return bool
60+ */
61+ public function useHtmlComments ($ scopeCode = null ): bool
62+ {
63+ return $ this ->scopeConfig ->isSetFlag (
64+ self ::XML_PATH_CMS_IDENTIFIER_HTML_COMMENT ,
65+ ScopeInterface::SCOPE_STORE ,
66+ $ scopeCode
67+ );
68+ }
5569}
Original file line number Diff line number Diff line change 4141 <field id =" cms/pagebuilder/block_identifier_markup_enabled" >1</field >
4242 </depends >
4343 </field >
44+ <field id =" block_identifier_comment"
45+ translate =" label comment"
46+ type =" select"
47+ sortOrder =" 3020"
48+ showInDefault =" 1"
49+ showInWebsite =" 1"
50+ showInStore =" 1"
51+ canRestore =" 1" >
52+ <label >Use HTML Comments for non-HTML Content</label >
53+ <comment >
54+ A HTML comment will be used when the block content does not contain a wrapping HTML tag to edit.
55+ </comment >
56+ <source_model >Magento\Config\Model\Config\Source\Yesno</source_model >
57+ <depends >
58+ <field id =" cms/pagebuilder/block_identifier_markup_enabled" >1</field >
59+ </depends >
60+ </field >
4461 </group >
4562 </section >
4663 </system >
Original file line number Diff line number Diff line change 1212 <pagebuilder >
1313 <block_identifier_markup_enabled >1</block_identifier_markup_enabled >
1414 <block_identifier_attribute_name >block-identifier</block_identifier_attribute_name >
15+ <block_identifier_comment >1</block_identifier_comment >
1516 </pagebuilder >
1617 </cms >
1718 </default >
You can’t perform that action at this time.
0 commit comments