I'm a drupal newbie开发者_运维百科. In Drupal 7, I have an install file and I'm trying to get the schema to work for a text_with_summary.
Maybe I'm going about this the wrong way but I am using a form's install file to create the databases I will need. I just can't seem to get the "body" (called another name) field to work with text_with_summary.
I am using a form's install file to create the databases I will need.
Do you mean a module's install file (not being picky just trying to make sure we're talking about the same thing)?
text_with_summary
is not valid in a Drupal database schema (unless you're talking about a field schema but you surely would have mentioned that if you were). All valid field types for hook_schema()
are listed on the Schema API page. text_with_summary
is a widget type, not a database field type.
Posting some code would help an awful lot in trying to work out what you're trying to accomplish.
UPDATE
This will declare a table with an ID field and a text column suitable for holding the rich text you need:
function MYMODULE_schema() {
$schema['my_table'] = array(
'description' => 'Table description',
'fields' => array(
'id' => array(
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE
),
'text_column' => array(
'type' => 'text',
'size' => 'big',
'not null' => TRUE
)
),
'primary key' => array('id')
);
return $schema;
}
The Schema API is in invaluable reference page for this sort of thing.
When you want to display your form you'll probably want to look at the Form API documentation, particularly the drupal_get_form() function.
Hope that helps, downloading the Examples module would also be a very good idea, it has tons of well documented Drupal code examples.
精彩评论