Hello,

for a specific purpose, I had to configure the Body-field of a customised blog content-type (number of rows, weight etc...). But on the "manage field" part, the config option is disabled.

The only solution I found was to change it directly in the blog.module file here :

$form['body_filter']['body'] = array('#type' => 'textarea', '#title' => check_plain($type->body_label), '#default_value' => $node->body, '#rows' => 20, '#required' => TRUE);

It works, but I was wondering if there is an easier way to configure it ?

At least, maybe this post could help someone else.

Comments

lhtown’s picture

Are you talking about the CCK module?

pacome’s picture

yes, in a way it's linked to it : I customised the blog content type with cck fields, but the body field stays not accessible for configuration. It's not handy, because the weight and the numbers of rows stays at the initial values.

It's possible to omit it by leaving the Body field label empty, and then puting another cck text field instead of it. And it does work until TinyMCE is not used.
If TinyMCE is used, the body field appear in the blog form , even if the label is blank.

I tried to disable TinyMCE for this specific field, and it almost works : the buttons don't appear, but the body field yes ! I think it's because the function used to disable TinyMCE for this field come after a kind of "ping" on the body field. Then, it appear on the form....

So... I just destroyed it in the blog.module file
It's not fair, but it works :)

(almost, it still appear in the admin/content/types/blog... But I keep it blank)

hansrossel’s picture

If you want to change a form of a module use hook_form_alter instead of hacking core:

Create a new module, so two files:
mymodule.info file with contents

name = Blog Helper module
description = Make body field of blog not required
dependencies = blog

mymodule.module file with contents:

  function blog_form_alter($form_id, &$form) {
    $form['body_filter']['body']['#required'] = FALSE;
  }

KOBA - Webdesign with Drupal

pacome’s picture

Nice !
Thank you !