Assign editor-profiles to content types
maulwuff - June 8, 2008 - 07:59
| Project: | FCKeditor - WYSIWYG HTML editor |
| Version: | 5.x-2.1 |
| Component: | User interface |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | fixed |
Description
Hi!
Is it possible to have multiple fck-profiles and assign them to certain content-types only?
What I do right now is:
- 2 profiles: enhanced-profile for "page" and basic-profile for "forum".
- visibility is set to "include" and paths are set to node/add/page and node/add/forum.
That works fine until I want to edit content:
The path is always node/*/edit. For "page" and "forum". So I can only have one editor-profile for this. :(
There is no php-evaluation which could solve this. Is there another way to get around this?
Thx for help!

#1
Ok, seems as if this scenario is completely undoable with fck.
I deleted the second profile and wanted to re-create it. Then it said, I can only assign one fck-profile per role. :(
#2
At this moment, you can force simplified toolbar on some fields.
So it is somehow possible to use two different toolbars in one profile... but that's all.
Anyway, I've never thought about assigning multiple profiles to a single role depending on content type. Sounds interesting, feel free to propose a patch.
#3
hehe, if I had a clue where to start, I might have already put something in :)
I did not have a look at the code, so my stupid proposal would sound like this:
- assuming, there are settings per node type
- on call of hook_form
--- check node type
--- return the appropriate profile
Do you think this is a passable way?
If it is, there need to be settings to assign a nodetype to a editor-profile.
In my eyes, assigning editor-profiles to roles is nonsense, because:
Assume you are a apprentice. Your task is to create the SAME workpiece as your instructor. The difference is, you have a handsaw, your instructor has a jigsaw. You will start scrubbing around with your handsaw, getting frustrated very quickly. Your instructor finishes in a fraction of time. Why all that? Life could be so easy ;)
That's the view I could compare me to my users. We all want to have a jigsaw for the same workpiece! On a different workpiece we want another tool, though.
#4
That may be the way to go but... how could you check what is the current content type in fckeditor_process_textarea() in Drupal 5/6?
In Drupal7, there will probably be #input_format available in Form API (http://drupal.org/node/125315) to help wysiwyg editors to use the correct buttons... or even to choose the correct wysiwyg editor, I think I have no idea how this can be achieved in Drupal 5/6.
#5
#252646: Simple editor everywhere but one textarea?, #273064: Allow profile to be used for a single node type and form for existing user roles marked as dup.
#6
Good question. Is there any chance to get the node or the form at this point?
what about getting this info from the url?
while creating a node, the type is in the url: arg(3);
node/add/contenttype
on formedit we could use arg(1) to get the nid.
node/XX/edit
#7
maulwuff's comment in comment#6 seems to be the way to go right now; these URLs are fairly fixed in Drupal 5, I believe. Let me know if there's anything I can do to help work on this.
#8
Unfortunately I may have no time this week to take care of this due to urgent server migration, but I like your ideas. Can you try to code it?
I can help if you have any specific questions.
#9
Sure; I'll try to get a patch to everyone shortly.
I've started working on the admin interface to select content types and have added a new table for storing the selections (and added an update script).
Do people feel this should just be an additional requirement to the user roles? IE, an fckeditor instance will show up only if the user role AND the content type is chosen? If this is the case, it might mean that user roles won't be unique across fckeditor profiles.
#10
"user role AND the content type"
please not!!
#11
How do you think the options should be setup so you can choose between roles and node types? Another radio box to choose between:
1) roles AND node types
2) roles OR node types
Either way, I still think the roles need to be allowed to be used across multiple fckeditor profiles; thoughts on that?
#12
My proposal is:
Choose either roles or content types.
Using roles + content types may be interesting too, though.
Maybe an opt-in? That is, checkboxes for roles and content types:
with both checked = roles + content types
with only roles checked = roles
with only content types checked = content types
do you think this is possible?
#13
This is actually what I had in mind but did a poor job explaining; I'll keep working towards this.
#14
Here's my first stab at enabling per-node-type configuration; it should work like maulwuff said in #12.
#15
That looks promissing! It doesn't work yet, for example it is impossible to select a role in "Roles allowed to use this profile" that is already used, but it definitely sounds like a way to go. It would be awesome if you could provide fully working patch.
#16
I'am searching for this option too. I think it's a very usable feature. Especcially for comments and forums vs 'create content'. When I was searching for this feature I saw this search-result:
FCKeditor Plus
... of FCKeditor to meet Drupal website to provide different toolbar for regular content type, forum and comment. So, a "page" can ...
I'am not authorized to access that page (Don't know why, just a newbie on drupal) Maybe it's useful.
#17
#245358: Change profile depending on content type or path marked as dup.
#18
#284285: Cant disable fckEditor on edit sections of specyfic content type... marked as duplicate.
#19
Fixed in CVS (tag DRUPAL-6--2)
#20
That's great to hear; sorry I hadn't been able to finish up my patch to make it function a little better.
Any chance of this being backported to the 5.x release? Would I be able to help with that at all?
#21
You can find what the content type can be with two methods:
$form['#node']);From the node object you can know its type by calling
node_type(), and passing the node reference to the function.I hope this can help.
#22
I got it from menu_get_item() in my patch actually, but it can be enhanced using your suggestions. An important note: currently this feature will only be made available for Drupal 6.
#23
Using
menu_get_item()can be useful, without to pass any arguments, when the menu path is something likenode/<nid>; it could not be of any help if the path is node/page/add, i.e.