Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / chi-teck / drupal-code-generator / templates / d7 / hook / field_schema.twig
1 /**
2  * Implements hook_field_schema().
3  */
4 function {{ machine_name }}_field_schema($field) {
5   if ($field['type'] == 'text_long') {
6     $columns = array(
7       'value' => array(
8         'type' => 'text',
9         'size' => 'big',
10         'not null' => FALSE,
11       ),
12     );
13   }
14   else {
15     $columns = array(
16       'value' => array(
17         'type' => 'varchar',
18         'length' => $field['settings']['max_length'],
19         'not null' => FALSE,
20       ),
21     );
22   }
23   $columns += array(
24     'format' => array(
25       'type' => 'varchar',
26       'length' => 255,
27       'not null' => FALSE,
28     ),
29   );
30   return array(
31     'columns' => $columns,
32     'indexes' => array(
33       'format' => array('format'),
34     ),
35     'foreign keys' => array(
36       'format' => array(
37         'table' => 'filter_format',
38         'columns' => array('format' => 'format'),
39       ),
40     ),
41   );
42 }