Mercurial > hg > cmmr2012-drupal-site
annotate vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_schema.twig @ 5:12f9dff5fda9 tip
Update to Drupal core 8.7.1
author | Chris Cannam |
---|---|
date | Thu, 09 May 2019 15:34:47 +0100 |
parents | c75dbcec494b |
children |
rev | line source |
---|---|
Chris@0 | 1 /** |
Chris@0 | 2 * Implements hook_field_schema(). |
Chris@0 | 3 */ |
Chris@0 | 4 function {{ machine_name }}_field_schema($field) { |
Chris@0 | 5 if ($field['type'] == 'text_long') { |
Chris@0 | 6 $columns = array( |
Chris@0 | 7 'value' => array( |
Chris@0 | 8 'type' => 'text', |
Chris@0 | 9 'size' => 'big', |
Chris@0 | 10 'not null' => FALSE, |
Chris@0 | 11 ), |
Chris@0 | 12 ); |
Chris@0 | 13 } |
Chris@0 | 14 else { |
Chris@0 | 15 $columns = array( |
Chris@0 | 16 'value' => array( |
Chris@0 | 17 'type' => 'varchar', |
Chris@0 | 18 'length' => $field['settings']['max_length'], |
Chris@0 | 19 'not null' => FALSE, |
Chris@0 | 20 ), |
Chris@0 | 21 ); |
Chris@0 | 22 } |
Chris@0 | 23 $columns += array( |
Chris@0 | 24 'format' => array( |
Chris@0 | 25 'type' => 'varchar', |
Chris@0 | 26 'length' => 255, |
Chris@0 | 27 'not null' => FALSE, |
Chris@0 | 28 ), |
Chris@0 | 29 ); |
Chris@0 | 30 return array( |
Chris@0 | 31 'columns' => $columns, |
Chris@0 | 32 'indexes' => array( |
Chris@0 | 33 'format' => array('format'), |
Chris@0 | 34 ), |
Chris@0 | 35 'foreign keys' => array( |
Chris@0 | 36 'format' => array( |
Chris@0 | 37 'table' => 'filter_format', |
Chris@0 | 38 'columns' => array('format' => 'format'), |
Chris@0 | 39 ), |
Chris@0 | 40 ), |
Chris@0 | 41 ); |
Chris@0 | 42 } |