Answer the question
In order to leave comments, you need to log in
Is it possible to assign a visual editor in CMS Joomla for each category of materials in its own way?
Let's say I have Category_1 and Category_2. In view of the peculiarities, I need to edit Category_1 through JCE, and Category_2 through CodeMirror. Is it somehow possible to implement this idea automatically, without constant running around in the "System -> General Settings" menu to change the editor?
Answer the question
In order to leave comments, you need to log in
By binding the plugin (or its settings, or through general settings) or only by refining through the code.
Sharing how I ALMOST solved this problem. So, we do the following:
1. In the default admin template (most likely you have Isis), create 2 folders in the html folder - com_modules and com_content. In the com_modules folder we create the module folder, in the com_content folder we create the article folder. As a result, the following paths will be obtained: site.ru/administrator/templates/isis/html/com_modules/module and site.ru/administrator/templates/isis/html/com_content/article .
2. Go along the path site.ru/administrator/components/com_content/views/article/tmpl , find the edit.php file inside . We transfer its copy to site.ru/administrator/templates/isis/html/com_content/article . Similarly, we transfer the edit.php filefrom site.ru/administrator/components/com_modules/views/module/tmpl to site.ru/administrator/templates/isis/html/com_modules/module .
3. In the edit.php files that were copied to the template folder, after the line,
paste the code:
$editor1 = "jce"; //название редактора для категории с ID=2 (в моём случае)
$editor2 = "codemirror"; //название редактора для всех иных категорий
$catid = $this->form->getValue("catid"); //получаем номер данной категории материала
$tmp_user = JFactory::getUser(); //инициализируем временный массив tmp_user, где хранится
//класс с информацией о параметрах пользователя. Тут же хранится и текстовый редактор
//для данного пользователя.
if ($catid == "2"){ //если редактируем материал с ID статьи = 2, то...
$tmp_user->setParam('editor',$editor1); //устанавливаем редактор под именем $editor1
} else { //если редактируем материал с ID статьи отличной от 2, то...
$tmp_user->setParam('editor',$editor2); //устанавливаем редактор под именем $editor2
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question