Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TinyMCE: disable WYSIWYG if not installed #4495

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions app/code/core/Mage/Cms/Model/Wysiwyg/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
* @license https://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/

use Composer\InstalledVersions;

/**
* Wysiwyg Config for Editor HTML Element
*
Expand All @@ -25,6 +27,11 @@
*/
class Mage_Cms_Model_Wysiwyg_Config extends Varien_Object
{
/**
* Wysiwyg store config path
*/
public const WYSIWYG_CONFIG_ENABLED = 'cms/wysiwyg/enabled';

/**
* Wysiwyg behaviour: enabled
*/
Expand Down Expand Up @@ -138,11 +145,15 @@ public function getSkinImagePlaceholderPath()
*/
public function isEnabled()
{
if (!InstalledVersions::isInstalled('tinymce/tinymce')) {
return false;
}

$storeId = $this->getStoreId();
if (!is_null($storeId)) {
$wysiwygState = Mage::getStoreConfig('cms/wysiwyg/enabled', $storeId);
$wysiwygState = Mage::getStoreConfig(self::WYSIWYG_CONFIG_ENABLED, $storeId);
} else {
$wysiwygState = Mage::getStoreConfig('cms/wysiwyg/enabled');
$wysiwygState = Mage::getStoreConfig(self::WYSIWYG_CONFIG_ENABLED);
}
return in_array($wysiwygState, [self::WYSIWYG_ENABLED, self::WYSIWYG_HIDDEN]);
}
Expand All @@ -154,6 +165,6 @@ public function isEnabled()
*/
public function isHidden()
{
return Mage::getStoreConfig('cms/wysiwyg/enabled') == self::WYSIWYG_HIDDEN;
return Mage::getStoreConfig(self::WYSIWYG_CONFIG_ENABLED) == self::WYSIWYG_HIDDEN;
}
}
Loading