Allow empty cms page content

When using a cms page in magento, I sometimes need an empty content section. In most cases, this is for my homepage. But purple makes me put something in the content before it can be saved.

Is there a way to get purple to allow the empty contents of a cms page?

+6
source share
5 answers

The Mage_Adminhtml_Block_Cms_Page_Edit_Tab_Content::_prepareForm() method Mage_Adminhtml_Block_Cms_Page_Edit_Tab_Content::_prepareForm() event. You can observe this event, grab the field from the form object that is passed to the event, and change its required property to false .

+6
source

You can use an empty div or span

+8
source

This is a quick and dirty fix, you should really override the admin class so as not to lose the changes during the next update.

In any case, in the file app/code/core/Mage/Adminhtml/Block/Cms/Page/Edit/Tab/Content.php , in function _prepareForm() , line 82, change:

 $contentField = $fieldset->addField('content', 'editor', array( 'name' => 'content', 'style' => 'height:36em;', 'required' => true, 'disabled' => $isElementDisabled, 'config' => $wysiwygConfig )); 

to

  $contentField = $fieldset->addField('content', 'editor', array( 'name' => 'content', 'style' => 'height:36em;', 'required' => false, 'disabled' => $isElementDisabled, 'config' => $wysiwygConfig )); 
+5
source

add <div>&zwj;</div> inside your empty elements to stop the removal of magenta cms

+3
source

This is not particularly elegant, but you can simply type &nbsp; and / or hide content using CSS

+2
source

Source: https://habr.com/ru/post/921598/


All Articles