Skip to content

Commit 0e5b29f

Browse files
committed
[K5.2] Add a template params to load a custom config file for ckeditor
1 parent 9ba2ee1 commit 0e5b29f

File tree

7 files changed

+17
-3
lines changed

7 files changed

+17
-3
lines changed

src/administrator/components/com_kunena/controllers/templates.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -863,6 +863,15 @@ protected function _saveParamFile($template)
863863
}
864864
}
865865

866+
if (!empty($params['ckeditorcustomprefixconfigfile']))
867+
{
868+
if (!JFolder::exists(KPATH_MEDIA . '/core/js/' . $params['ckeditorcustomprefixconfigfile']) . 'ckeditor_config.js')
869+
{
870+
$params['ckeditorcustomprefixconfigfile'] = '';
871+
$this->app->enqueueMessage(Text::_('COM_KUNENA_A_TEMPLATE_MANAGER_CANNOT_FIND_CKEDITOR_CUSTOM_CONFIG_FILE'),'error');
872+
}
873+
}
874+
866875
$file = KPATH_SITE . '/template/' . $template . '/config/params.ini';
867876

868877
if (count($params) > 0)

src/administrator/components/com_kunena/language/en-GB/en-GB.com_kunena.controllers.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ COM_KUNENA_TEMPLATES_SETTINGS_RESTORED_SUCCESSFULLY = "The template settings has
8585
COM_KUNENA_TRASH_RESTORE_TEMPLATE_SETTINGS = "Restore"
8686
COM_KUNENA_A_TEMPLATE_MANAGER_TEMPLATE_NOT_COMPATIBLE_WITH_KUNENA_INSTALLED_VERSION = "The template %s in version %s which are trying to install isn't compatible with your Kunena version."
8787
COM_KUNENA_A_TEMPLATE_MANAGER_CANNOT_FIND_CKEDITOR_SKIN = "The name of your skin for CKeditor can't be found on the system, this parameter has been resetted."
88+
COM_KUNENA_A_TEMPLATE_MANAGER_CANNOT_FIND_CKEDITOR_CUSTOM_CONFIG_FILE = "The custom config file for CKeditor defined in parameters can't be found on the system"
8889

8990
; JROOT/administrator/components/com_kunena/controllers/tools.php
9091

src/administrator/components/com_kunena/language/en-GB/en-GB.com_kunena.views.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -870,6 +870,8 @@ COM_KUNENA_TEMPLATE_DISPLAY_JUSTIFIYTEXT_DESC = "Show <strong>Justify</strong> b
870870
COM_KUNENA_TEMPLATE_SUBJECT_LENGTH_MESSAGE_LENGTH_DESC = "Max. message title length in message"
871871
COM_KUNENA_TEMPLATE_NAME_OF_SKIN_CKEDITOR = "Set the name of the skin which needs to be used with CKeditor."
872872
COM_KUNENA_TEMPLATE_NAME_OF_SKIN_CKEDITOR_DESC = "Set the name of the skin which needs to be used with CKeditor, the skin should be exist already in the skins directory."
873+
COM_KUNENA_TEMPLATE_NAME_OF_PREFIX_FOR_CUSTOM_CKEDITOR_CONFIG_FILE = "Set the name of the prefix to load a custom config file for CKeditor"
874+
COM_KUNENA_TEMPLATE_NAME_OF_PREFIX_FOR_CUSTOM_CKEDITOR_CONFIG_FILE_DESC = "Set the name of the prefix to load a custom config file for CKeditor"
873875
COM_KUNENA_TEMPLATE_CATEGORY_IMAGEPATH_LABEL = "Category Image Path"
874876
COM_KUNENA_TEMPLATE_CATEGORY_IMAGEPATH_DESC = "Category Image Path. If you set the path as category_images, the full path will be your_html_rootfolder/media/kunena/category_images/"
875877
COM_KUNENA_TEMPLATE_RECOVER = "Recover crash and store fields"

src/components/com_kunena/template/crypsis/config/config.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,8 @@
323323
<field name="editorButtons" type="hidden" default=""/>
324324
<field name="nameskinckeditor" type="text" default="" label="COM_KUNENA_TEMPLATE_NAME_OF_SKIN_CKEDITOR"
325325
description="COM_KUNENA_TEMPLATE_NAME_OF_SKIN_CKEDITOR_DESC"/>
326+
<field name="ckeditorcustomprefixconfigfile" type="text" default="" label="COM_KUNENA_TEMPLATE_NAME_OF_PREFIX_FOR_CUSTOM_CKEDITOR_CONFIG_FILE"
327+
description="COM_KUNENA_TEMPLATE_NAME_OF_PREFIX_FOR_CUSTOM_CKEDITOR_CONFIG_FILE_DESC"/>
326328
</fieldset>
327329

328330
<fieldset name="COM_KUNENA_TEMPLATE_TAB_AVATAR">

src/components/com_kunena/template/crypsis/layouts/widget/editor/ckeditor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
use Joomla\CMS\Language\Text;
1414

1515
$this->addScript('ckeditor.js');
16-
$this->addScriptOptions('com_kunena.ckeditor_config', 'ckeditor_config.js');
16+
$this->addScriptOptions('com_kunena.ckeditor_config', $this->template->params->get('ckeditorcustomprefixconfigfile') . 'ckeditor_config.js');
1717
$this->addScriptOptions('com_kunena.ckeditor_buttons_configuration', $this->template->params->get('editorButtons'));
1818
$this->addScriptOptions('com_kunena.ckeditor_subfolder', Joomla\CMS\Uri\Uri::root(true));
1919
$this->addScriptOptions('com_kunena.ckeditor_skiname', $this->template->params->get('nameskinckeditor'));

src/components/com_kunena/template/crypsisb3/layouts/widget/editor/ckeditor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
use Joomla\CMS\Language\Text;
1414

1515
$this->addScript('ckeditor.js');
16-
$this->addScriptOptions('com_kunena.ckeditor_config', 'ckeditor_config.js');
16+
$this->addScriptOptions('com_kunena.ckeditor_config', $this->template->params->get('ckeditorcustomprefixconfigfile') . 'ckeditor_config.js');
1717
$this->addScriptOptions('com_kunena.ckeditor_buttons_configuration', $this->template->params->get('editorButtons'));
1818
$this->addScriptOptions('com_kunena.ckeditor_subfolder', Joomla\CMS\Uri\Uri::root(true));
1919
$this->addScriptOptions('com_kunena.ckeditor_skiname', $this->template->params->get('nameskinckeditor'));

src/components/com_kunena/template/crypsisb4/layouts/widget/editor/ckeditor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
use Joomla\CMS\Language\Text;
1414

1515
$this->addScript('ckeditor.js');
16-
$this->addScriptOptions('com_kunena.ckeditor_config', 'ckeditor_config.js');
16+
$this->addScriptOptions('com_kunena.ckeditor_config', $this->template->params->get('ckeditorcustomprefixconfigfile') . 'ckeditor_config.js');
1717
$this->addScriptOptions('com_kunena.ckeditor_buttons_configuration', $this->template->params->get('editorButtons'));
1818
$this->addScriptOptions('com_kunena.ckeditor_subfolder', Joomla\CMS\Uri\Uri::root(true));
1919
$this->addScriptOptions('com_kunena.ckeditor_skiname', $this->template->params->get('nameskinckeditor'));

0 commit comments

Comments
 (0)