How I get it here http://drupal.org/update/modules/6/7#text_format_string format use now a text identifier so why hook_field_shema use and "int"?

$columns += array(
'format' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => FALSE,
),
);
?>

See http://api.drupal.org/api/drupal/modules--field--field.api.php/function/...

Comments

bfroehle’s picture

Component: database system » documentation
Category: support » bug
Issue tags: +Novice

So it's a documentation bug. text_field_schema does, of course, use the correct definition:

array(
    'format' => array(
      'type' => 'varchar', 
      'length' => 255, 
      'not null' => FALSE,
    )

Tagging this as Novice, as it should be straightforward to update the example code in field.api.php to better match the text_field_schema example.

damien tournoud’s picture

Version: 7.x-dev » 8.x-dev

Triaging.

jhodgdon’s picture

Title: Why hook_field_shema use int type for "format" field? » hook_field_shema doc has incorrect field type in format in example

updating title. So the task here is to patch the example function body for hook_field_schema() so it uses the correct 'format' component, which you can find in text_field_schema().

Anonymous’s picture

Assigned: Unassigned » linclark

Tagging as mine for now, I'm going to be showing 3 people how to roll patches tomorrow and will use this as an example.

barbi’s picture

Newbie to Drupal looking for novice tickets.
Please assign this ticket to me, if think someone else can work on it. Thanks.

Anonymous’s picture

Assigned: linclark » Unassigned

Awesome, thanks barbi! I'll be happy to review when you've posted a patch.

barbi’s picture

Assigned: Unassigned » barbi
Status: Active » Needs review
StatusFileSize
new389 bytes
jhodgdon’s picture

Status: Needs review » Needs work

I don't think this is quite right. We need the 'format' piece to look like the example in comment #1 above.

barbi’s picture

StatusFileSize
new422 bytes

Changed the "format" array to example in comment #1

barbi’s picture

Status: Needs work » Needs review
jhodgdon’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +Needs backport to D7

Looks good! Thanks for all the patching, barbi! Please commit to d8/7.

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Committed to 8.x and 7.x. Thanks!

Automatically closed -- issue fixed for 2 weeks with no activity.