Skip to content
Snippets Groups Projects

Add multiple contentCSS support

Merged Alexander Grein requested to merge agrein/tinymce4_rte:master into master
+ 10
9
Compare changes
  • Side-by-side
  • Inline
@@ -593,15 +593,16 @@ class RichTextElement extends AbstractFormElement {
$tinyMCE = GeneralUtility::makeInstance(Loader::class);
$tinyMCE->loadConfiguration($this->vanillaRteTsConfig['properties']['default.']['tinymceConfiguration']);
if ($this->vanillaRteTsConfig['properties']['default.']['contentCSS'] !== '') {
$contentCssFile = GeneralUtility::getFileAbsFileName(
$this->vanillaRteTsConfig['properties']['default.']['contentCSS']
);
if (is_file($contentCssFile)) {
$contentCssFile = GeneralUtility::getIndpEnv('TYPO3_SITE_URL') .
PathUtility::stripPathSitePrefix($contentCssFile) . '?' . filemtime($contentCssFile);
$tinyMCE->addConfigurationOption('content_css', $contentCssFile);
$contentCssArray = is_array($this->vanillaRteTsConfig['properties']['default.']['contentCSS.']) ? $this->vanillaRteTsConfig['properties']['default.']['contentCSS.'] : (array)$this->vanillaRteTsConfig['properties']['default.']['contentCSS'];
if (!empty($contentCssArray)) {
$contentCssFileArray = array();
foreach ($contentCssArray as $contentCssKey => $contentCssFile) {
$contentCssFileAbs = GeneralUtility::getFileAbsFileName(trim($contentCssFile));
if (is_file($contentCssFileAbs)) {
$contentCssFileArray[] = GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . PathUtility::stripPathSitePrefix($contentCssFileAbs) . '?' . filemtime($contentCssFileAbs);
}
}
$tinyMCE->addConfigurationOption('content_css', implode(',', $contentCssFileArray));
}
}
Loading