Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[K5.2] Add a template params to load a custom config file for ckeditor
  • Loading branch information
xillibit committed Jan 18, 2021
1 parent 9ba2ee1 commit 0e5b29f
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 3 deletions.
Expand Up @@ -863,6 +863,15 @@ protected function _saveParamFile($template)
}
}

if (!empty($params['ckeditorcustomprefixconfigfile']))
{
if (!JFolder::exists(KPATH_MEDIA . '/core/js/' . $params['ckeditorcustomprefixconfigfile']) . 'ckeditor_config.js')
{
$params['ckeditorcustomprefixconfigfile'] = '';
$this->app->enqueueMessage(Text::_('COM_KUNENA_A_TEMPLATE_MANAGER_CANNOT_FIND_CKEDITOR_CUSTOM_CONFIG_FILE'),'error');
}
}

$file = KPATH_SITE . '/template/' . $template . '/config/params.ini';

if (count($params) > 0)
Expand Down
Expand Up @@ -85,6 +85,7 @@ COM_KUNENA_TEMPLATES_SETTINGS_RESTORED_SUCCESSFULLY = "The template settings has
COM_KUNENA_TRASH_RESTORE_TEMPLATE_SETTINGS = "Restore"
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."
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."
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"

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

Expand Down
Expand Up @@ -870,6 +870,8 @@ COM_KUNENA_TEMPLATE_DISPLAY_JUSTIFIYTEXT_DESC = "Show <strong>Justify</strong> b
COM_KUNENA_TEMPLATE_SUBJECT_LENGTH_MESSAGE_LENGTH_DESC = "Max. message title length in message"
COM_KUNENA_TEMPLATE_NAME_OF_SKIN_CKEDITOR = "Set the name of the skin which needs to be used with CKeditor."
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."
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"
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"
COM_KUNENA_TEMPLATE_CATEGORY_IMAGEPATH_LABEL = "Category Image Path"
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/"
COM_KUNENA_TEMPLATE_RECOVER = "Recover crash and store fields"
Expand Down
2 changes: 2 additions & 0 deletions src/components/com_kunena/template/crypsis/config/config.xml
Expand Up @@ -323,6 +323,8 @@
<field name="editorButtons" type="hidden" default=""/>
<field name="nameskinckeditor" type="text" default="" label="COM_KUNENA_TEMPLATE_NAME_OF_SKIN_CKEDITOR"
description="COM_KUNENA_TEMPLATE_NAME_OF_SKIN_CKEDITOR_DESC"/>
<field name="ckeditorcustomprefixconfigfile" type="text" default="" label="COM_KUNENA_TEMPLATE_NAME_OF_PREFIX_FOR_CUSTOM_CKEDITOR_CONFIG_FILE"
description="COM_KUNENA_TEMPLATE_NAME_OF_PREFIX_FOR_CUSTOM_CKEDITOR_CONFIG_FILE_DESC"/>
</fieldset>

<fieldset name="COM_KUNENA_TEMPLATE_TAB_AVATAR">
Expand Down
Expand Up @@ -13,7 +13,7 @@
use Joomla\CMS\Language\Text;

$this->addScript('ckeditor.js');
$this->addScriptOptions('com_kunena.ckeditor_config', 'ckeditor_config.js');
$this->addScriptOptions('com_kunena.ckeditor_config', $this->template->params->get('ckeditorcustomprefixconfigfile') . 'ckeditor_config.js');
$this->addScriptOptions('com_kunena.ckeditor_buttons_configuration', $this->template->params->get('editorButtons'));
$this->addScriptOptions('com_kunena.ckeditor_subfolder', Joomla\CMS\Uri\Uri::root(true));
$this->addScriptOptions('com_kunena.ckeditor_skiname', $this->template->params->get('nameskinckeditor'));
Expand Down
Expand Up @@ -13,7 +13,7 @@
use Joomla\CMS\Language\Text;

$this->addScript('ckeditor.js');
$this->addScriptOptions('com_kunena.ckeditor_config', 'ckeditor_config.js');
$this->addScriptOptions('com_kunena.ckeditor_config', $this->template->params->get('ckeditorcustomprefixconfigfile') . 'ckeditor_config.js');
$this->addScriptOptions('com_kunena.ckeditor_buttons_configuration', $this->template->params->get('editorButtons'));
$this->addScriptOptions('com_kunena.ckeditor_subfolder', Joomla\CMS\Uri\Uri::root(true));
$this->addScriptOptions('com_kunena.ckeditor_skiname', $this->template->params->get('nameskinckeditor'));
Expand Down
Expand Up @@ -13,7 +13,7 @@
use Joomla\CMS\Language\Text;

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

0 comments on commit 0e5b29f

Please sign in to comment.