Skip to content

Commit c67f935

Browse files
authored
TinyMCE: disable WYSIWYG if not installed (#4495)
* TinyMCE: disable WYSIWYG if not installed * use composer-runtime-api
1 parent 1d6e002 commit c67f935

File tree

3 files changed

+19
-7
lines changed

3 files changed

+19
-7
lines changed

app/code/core/Mage/Cms/Model/Wysiwyg/Config.php

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
* @license https://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
1515
*/
1616

17+
use Composer\InstalledVersions;
18+
1719
/**
1820
* Wysiwyg Config for Editor HTML Element
1921
*
@@ -25,6 +27,11 @@
2527
*/
2628
class Mage_Cms_Model_Wysiwyg_Config extends Varien_Object
2729
{
30+
/**
31+
* Wysiwyg store config path
32+
*/
33+
public const WYSIWYG_CONFIG_ENABLED = 'cms/wysiwyg/enabled';
34+
2835
/**
2936
* Wysiwyg behaviour: enabled
3037
*/
@@ -138,11 +145,15 @@ public function getSkinImagePlaceholderPath()
138145
*/
139146
public function isEnabled()
140147
{
148+
if (!InstalledVersions::isInstalled('tinymce/tinymce')) {
149+
return false;
150+
}
151+
141152
$storeId = $this->getStoreId();
142153
if (!is_null($storeId)) {
143-
$wysiwygState = Mage::getStoreConfig('cms/wysiwyg/enabled', $storeId);
154+
$wysiwygState = Mage::getStoreConfig(self::WYSIWYG_CONFIG_ENABLED, $storeId);
144155
} else {
145-
$wysiwygState = Mage::getStoreConfig('cms/wysiwyg/enabled');
156+
$wysiwygState = Mage::getStoreConfig(self::WYSIWYG_CONFIG_ENABLED);
146157
}
147158
return in_array($wysiwygState, [self::WYSIWYG_ENABLED, self::WYSIWYG_HIDDEN]);
148159
}
@@ -154,6 +165,6 @@ public function isEnabled()
154165
*/
155166
public function isHidden()
156167
{
157-
return Mage::getStoreConfig('cms/wysiwyg/enabled') == self::WYSIWYG_HIDDEN;
168+
return Mage::getStoreConfig(self::WYSIWYG_CONFIG_ENABLED) == self::WYSIWYG_HIDDEN;
158169
}
159170
}

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"ext-simplexml": "*",
2525
"ext-soap": "*",
2626
"ext-zlib": "*",
27+
"composer-runtime-api": "^2",
2728
"colinmollenhour/cache-backend-redis": "^1.14",
2829
"colinmollenhour/magento-redis-session": "^3.2.0",
2930
"cweagans/composer-patches": "^1.7",
@@ -48,7 +49,6 @@
4849
},
4950
"require-dev": {
5051
"ext-xmlreader": "*",
51-
"composer/composer": "^2.7",
5252
"dealerdirect/phpcodesniffer-composer-installer": "^1.0.0",
5353
"friendsofphp/php-cs-fixer": "^3.6",
5454
"macopedia/phpstan-magento1": "^1.1",

composer.lock

Lines changed: 4 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)