Take the 2-minute tour ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

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!

share|improve this question
    
You might want to look up 'module development'... –  Alex Gill Jul 4 '12 at 14:44
add comment

1 Answer

up vote 0 down vote accepted

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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