I want to set ckeditor tool bar based on the user type and some condition.
Partialy I done as below:
switch(UserMode)
{
case "1":
config.toolbar_MyTool = [
['Find', 'SelectAll'], ['Anchor'], ['Maximize']
];
break;
case "2":
config.toolbar_MyTool = [
['Find'], ['Anchor'], ['Maximize']
];
break;
}
Code goes long based on the usermode
so I want to create a array and just I want to assign the toolbar
like as below:
config.toolbar_MyTool = myToolArray;
Also I want to check own post or other person post. If it is own post I want to add some tools additionally.
You would start by defining your different toolbars in the config.js
Those toolbar-definitions can then be used later in your page, but be aware that as soon as you create an instance of CKEditor, the toolbar layout CAN NOT be changed:
Solution 1:
You would have to create a new instance to change the toolbar dynamically:
Solution 2:
However, if you are happy with showing the full toolbar also in usermode 2 and greying the SelectAll-Button, then the following could be your solution:
[EDIT feb 15]
Solution 3:
According to your comment -> how to dynamically construct with array.push
No configuration needed in config.js