2

I have defined a new content type, that just has a body field, which I define in my install file:

$type = array(
        'type' => 'status_update',
        'name' => t('Status Update'),
        'module' => 'socmed',
        'base' => 'node_content',
        'description' => t('A Facebook-like status update.'),
        'has_title' => FALSE,
        'custom' => TRUE
        );

    // Turn off comments.
    variable_set('comment_status_update', 0);

    // Fill in remaining defaults, add a body field and save the node type.
    $type = node_type_set_defaults($type);
    node_add_body_field($type);
    node_type_save($type);

I would now like to

a) Create a new text format.

b) Assign that text format to be the default for this content type's body.

c) Set permissions on the text format for normal authenticated users, so that this text format is the only option.

I want to package this up as a module, so I would like to do so programatically, but I'm not sure how to go about it. Any pointers on any of these steps? Thanks!

  • You might want to look up 'module development'... – Alex Gill Jul 4 '12 at 14:44
0

You're going to want to create your new input format separately (probably in a module), assign it to the fields in your content type, then export the fields again and bundle in your module.

Not knowing how complex your new input format is, best advice is to grab the examples module and check out the filter_example module for a good test case of how to create a new input format.

Once you have the input format created, go back to your content type and under "Structure > Content Types > Manage Fields" set the default input format for these fields to your new input format and export your fields to your module.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.