By bubuk.gabrok on
When creating content, I would like to have the input format for the Page node-type default to Filtered HTML AND
the Story node-type default to Full HTML.
I cannot locate any obvious swicthes from the admin->settings. Is this at all possible ?
Comments
I'm trying to do the same.
I'm trying to do the same. Anyone know if this is possible?
The Filter module description makes it sound like that's the way to do it, but I can't see how/where.
Ditto. I'm using
Ditto. I'm using freelinking and a flexinode type to create a wiki and I'd like to default (or restrict) users when editing a wiki page to only be allowed to use the freelinking input format.
TinyMCE
I am using TinyMCE for a WYSIWYG editor, and if 'full html' is not selected then line breaks do not appear in my comments or post (ANNOYING!).
So if anyone comes across this option, please share!
it's 2010 and it's still
it's 2010 and it's still haven't been figured out
Actually, it has been figured
Actually, it has been figured out: http://drupal.org/project/filterbynodetype
I'm trying to do the same.
I'm trying to do the same. Anyone know if this is possible?
The Filter module description makes it sound like that's the way to do it, but I can't see how/where.
Ford F Series Supercharger
Figured it out
Ok, I figured it out. I don't know why I didn't see it before. The option is under administrator > input format. It is that simple.
Not quite
Is there a way to set different defaults for different node-types? Right now, the default on admin->input formats sets the default for all nodes, right?
I'd be interested in this as
I'd be interested in this as well.
For example, it'd be great to be able to set bbcode for forum topics and comments, but rich text/tinymce for pages and stories.
This thread: http://drupal.org/node/35245
has a hack to associate input formats to content types, but I'm not sure if that'd work with 4.7
Is this something that could be incorporated into CCK? Ideally, in the same way default publishing options are set for node types, input format could be set there as well.
You can hardcode node filter form in a module.
One way to achieve this is set the default to "Filtered HTML" and in any modules you want a different defaul format, in the _form hook, you'll find something like:
$form['body_filter']['filter'] = filter_form($node->format);
You can hardcode a module to always default to a specific format - in my case Full HTML is format 3 (did a printf to find this).
$form['body_filter']['filter'] = filter_form(3);
Users couldn't override it anymore, but in my case I don't want them to anyway.
Thanks, that work for me.
Thanks, that work for me.
Thanks but please explain a little more.
This sounds exactly like what I want.
I would like users to always be using the default Input Format when in the forum, typing comments, etc. But when they are adding content in the Wiki (Liquid Wiki) I would like the only option to be the Wiki Input Type (an Input Type I manually created). Right now they have to change it from the default to Wiki when creating new content.
I admit I'm not knowledgeable enough to understand what gbear means.
#1 Am I supposed to enter the hardcoded body filter line into liquid.module file? Or where is the "_form hook"
#2 What is meant by "printf to find this"? I tried things like:
...but I'm not getting any results.
Thanks in advance!
hook_form
I looked into the hook_form some more: http://api.drupal.org/api/4.7/function/hook_form
I created this in the liquid.module file:
function hook_form() {
$form['body_filter']['filter'] = filter_form(4);
return $form;
}
Alas, it still doesn't seem to change the input filter. I am I on the right path? I'm I in the right file?
Is this question buried?
I have a feeling my question is buried in this node. If anyone can answer it I would really appreciate it, cuz It's driving me nuts. Thanks.
i think youre doing it
i think youre doing it wrong.
what the poster was trying to say is you need to make the changes in the module_form() function of your module.
eg: if your module is hello.module, then the function you need to touch is hello_form()
This function must be already there, and it is responsible for diaplying the input form of the module to your user.
Now in this function, you can specify what inpur fotmat you want as default:
by pasting the line thats mentioned in his post.
hth,
reggie
Thank you, thank you, thank
Thank you, thank you, thank you.
I had to stumble around for a but longer, but I found the line in the liquid_wikipage.module instead of the liquid.module and after some trial and error about what number to put in I have it working perfectly. Ya!
Glad to have this issue past me. It will increase usability so much.
Thanks again!
glad it worked :)
glad it worked :)
$form['body_filter']['filter
I am trying to do this, but when I edit the module file vote_storylink.module it simply does nothing, Except the administrators default input changes, however non administrators have no change to there input types.
I'm trying to edit vote_storylink.module from the vote up down so that it only accepts plain text, I created a plain text filter, then modified the module file as above but instead of changing to filter 3 I chose 4 I'm using 4.7 any ideas?
is this the right way?
Thanks a lot for this thread - I managed to change the default input format for my wiki by changing a line in the node.module to:
$form['body_filter']['format'] = filter_form(7);However, I'm not sure this is the best way to do it, hacking a core module - so I guess my question is - is there a better way to do this - perhaps by adding some lines to my template.php?
thanks
Solution is here
http://drupal.org/project/filterbynodetype
cross post of
http://drupal.org/node/35245#comment-241160
Comments?
Unfortunately this does not allow you to separate out the comments for their own formatting. I don't want the same kind of formatting available to a normal post and a comment.
Subscribing cos I've spent
Subscribing cos I've spent ages on this and found no solution.
Kineta Systems - Web Development in Nottingham
I did a rough porting to 6.x
I did a rough porting of the filterbynodetype module to Drupal core 6.x.
I've also extended the module so that it also allows to select which input filters can be used with comments.
If you want to give it a try, you can download it from http://danielepighin.net/cms/software .
great module
This is a great module for 5.X.X
http://drupal.org/project/filterbynodetype
sharma chelluri
Works for 6.x
I needed this functionality to restrict node input filters for Wiki nocdes (limit to Twiki Wiki filter). Thanks, works great in 6.x!
"There's a module for it." - anonymous
hook_node_form_submit
I was able to accomplish what I wanted by a different method. I have just one content type where I want to use a different input format. I created a custom module and use the following hook to change the input format upon submission (before the form contents are sent to be processed and saved).
Help!!
I tried all the solutions i have seen here. None of it seems to work. What might I have done wrong?
What you did wrong
You spammed the node with the stink of your spam link.
Try this, it has worked for me in Drupal 6
If you want to change the default input format for the body field of a specific content type, using hook_form_alter:
On my system values are 1 for Filtered HTML, 2 for Full HTML, 3 for Messaging plain text, 4 for PHP code and 5 for WYSIWYG. Yours may be different, try doing a
print_r($form['body_field']['format'])
to see your actual values.
I think, for this function
I think,
for this function you can use module "Better Formats" .
Tomas
A bit late to the party, but
A bit late to the party, but what Tomas said. Install better_formats and one of the functions that provides is allowing different default entry types per role for each content type. You have to turn this on under the setting for better_formats and then go to the content type and configure it there.
Doing this with hook_form_alter or hook_elements
Use hook_form_alter and an after_build function. Afterbuilds are a bit weird. Don't forget to return $form in the afterbuild, and make sure to take a look at the structure of the $form object, because it changes in the afterbuild function.
If you're doing this in conjunction with better formats, you'll need to use hook_elements instead. Make sure your module weight is higher than BF in the system table so your hook runs after
This is a D7 core bug
There is a working patch over at #1278886: Default text formats are not saved properly without accompanying values