79 lines
1.5 KiB
Plaintext
79 lines
1.5 KiB
Plaintext
<?php
|
|
|
|
/**
|
|
* @file
|
|
* Install, update, and uninstall functions for the Text module.
|
|
*/
|
|
|
|
/**
|
|
* Implements hook_field_schema().
|
|
*/
|
|
function text_field_schema($field) {
|
|
switch ($field['type']) {
|
|
case 'text':
|
|
$columns = array(
|
|
'value' => array(
|
|
'type' => 'varchar',
|
|
'length' => $field['settings']['max_length'],
|
|
'not null' => FALSE,
|
|
),
|
|
);
|
|
break;
|
|
|
|
case 'text_long':
|
|
$columns = array(
|
|
'value' => array(
|
|
'type' => 'text',
|
|
'size' => 'big',
|
|
'not null' => FALSE,
|
|
),
|
|
);
|
|
break;
|
|
|
|
case 'text_with_summary':
|
|
$columns = array(
|
|
'value' => array(
|
|
'type' => 'text',
|
|
'size' => 'big',
|
|
'not null' => FALSE,
|
|
),
|
|
'summary' => array(
|
|
'type' => 'text',
|
|
'size' => 'big',
|
|
'not null' => FALSE,
|
|
),
|
|
);
|
|
break;
|
|
}
|
|
$columns += array(
|
|
'format' => array(
|
|
'type' => 'varchar',
|
|
'length' => 255,
|
|
'not null' => FALSE,
|
|
),
|
|
);
|
|
return array(
|
|
'columns' => $columns,
|
|
'indexes' => array(
|
|
'format' => array('format'),
|
|
),
|
|
'foreign keys' => array(
|
|
'format' => array(
|
|
'table' => 'filter_format',
|
|
'columns' => array('format' => 'format'),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Moves teaser length from variable to config.
|
|
*
|
|
* @ingroup config_upgrade
|
|
*/
|
|
function text_update_8000() {
|
|
update_variables_to_config('text.settings', array(
|
|
'teaser_length' => 'default_summary_length',
|
|
));
|
|
}
|