| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327 |
- <?php
- /**
- * @file
- * Display Suite install file.
- */
- /**
- * Implements hook_install().
- */
- function ds_install() {
- db_update('system')
- ->fields(array('weight' => 1))
- ->condition('name', 'ds')
- ->execute();
- }
- /**
- * Implements hook_uninstall().
- */
- function ds_uninstall() {
- variable_del('ds_classes_regions');
- }
- /**
- * Implements hook_schema().
- */
- function ds_schema() {
- $schema['ds_field_settings'] = array(
- 'description' => 'The table that holds Display Suite field settings per display.',
- // CTools export definitions.
- 'export' => array(
- 'key' => 'id',
- 'identifier' => 'ds_fieldsetting',
- 'default hook' => 'ds_field_settings_info',
- 'can disable' => FALSE,
- 'api' => array(
- 'owner' => 'ds',
- 'api' => 'ds',
- 'minimum_version' => 1,
- 'current_version' => 1,
- ),
- ),
- 'fields' => array(
- 'id' => array(
- 'description' => 'The unique id this setting.',
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'entity_type' => array(
- 'description' => 'The name of the entity.',
- 'type' => 'varchar',
- 'length' => 32,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'bundle' => array(
- 'description' => 'The name of the entity.',
- 'type' => 'varchar',
- 'length' => 64,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'view_mode' => array(
- 'description' => 'The name of the view_mode.',
- 'type' => 'varchar',
- 'length' => 64,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'settings' => array(
- 'description' => 'The Display Suite field settings for this layout.',
- 'type' => 'blob',
- 'not null' => FALSE,
- 'size' => 'big',
- 'serialize' => TRUE,
- ),
- ),
- 'primary key' => array('id'),
- 'indexes' => array(
- 'ds_entity' => array('entity_type'),
- 'ds_bundle' => array('bundle'),
- 'ds_view_mode' => array('view_mode'),
- ),
- );
- $schema['ds_layout_settings'] = array(
- 'description' => 'The table that holds the layouts configuration.',
- // CTools export definitions.
- 'export' => array(
- 'key' => 'id',
- 'identifier' => 'ds_layout',
- 'default hook' => 'ds_layout_settings_info',
- 'can disable' => FALSE,
- 'api' => array(
- 'owner' => 'ds',
- 'api' => 'ds',
- 'minimum_version' => 1,
- 'current_version' => 1,
- ),
- ),
- 'fields' => array(
- 'id' => array(
- 'description' => 'The unique id the layout.',
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'entity_type' => array(
- 'description' => 'The name of the entity.',
- 'type' => 'varchar',
- 'length' => 32,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'bundle' => array(
- 'description' => 'The name of the entity.',
- 'type' => 'varchar',
- 'length' => 64,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'view_mode' => array(
- 'description' => 'The name of the view_mode.',
- 'type' => 'varchar',
- 'length' => 64,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'layout' => array(
- 'description' => 'The name of the layout.',
- 'type' => 'varchar',
- 'length' => 64,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'settings' => array(
- 'description' => 'The settings for this layout.',
- 'type' => 'blob',
- 'not null' => FALSE,
- 'size' => 'big',
- 'serialize' => TRUE,
- ),
- ),
- 'primary key' => array('id'),
- 'indexes' => array(
- 'ds_entity' => array('entity_type'),
- 'ds_bundle' => array('bundle'),
- 'ds_view_mode' => array('view_mode'),
- ),
- );
- $schema['ds_view_modes'] = array(
- 'description' => 'The table that holds custom view modes managed by Display Suite.',
- // CTools export definitions.
- 'export' => array(
- 'key' => 'view_mode',
- 'identifier' => 'ds_view_mode',
- 'default hook' => 'ds_view_modes_info',
- 'can disable' => FALSE,
- 'api' => array(
- 'owner' => 'ds',
- 'api' => 'ds',
- 'minimum_version' => 1,
- 'current_version' => 1,
- ),
- ),
- 'fields' => array(
- 'view_mode' => array(
- 'description' => 'The machine name of the view mode.',
- 'type' => 'varchar',
- 'length' => 64,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'label' => array(
- 'description' => 'The label of the view mode.',
- 'type' => 'varchar',
- 'length' => 32,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'entities' => array(
- 'description' => 'The entities for this view mode.',
- 'type' => 'blob',
- 'not null' => FALSE,
- 'size' => 'big',
- 'serialize' => TRUE,
- ),
- ),
- 'primary key' => array('view_mode'),
- );
- $schema['ds_fields'] = array(
- 'description' => 'The table that holds custom fields managed by Display Suite.',
- // CTools export definitions.
- 'export' => array(
- 'key' => 'field',
- 'identifier' => 'ds_field',
- 'default hook' => 'ds_custom_fields_info',
- 'can disable' => FALSE,
- 'api' => array(
- 'owner' => 'ds',
- 'api' => 'ds',
- 'minimum_version' => 1,
- 'current_version' => 1,
- ),
- ),
- 'fields' => array(
- 'field' => array(
- 'description' => 'The machine name of the field.',
- 'type' => 'varchar',
- 'length' => 32,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'label' => array(
- 'description' => 'The label of the field.',
- 'type' => 'varchar',
- 'length' => 128,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'field_type' => array(
- 'description' => 'The type of of the field',
- 'type' => 'int',
- 'size' => 'small',
- 'not null' => TRUE,
- 'default' => 0,
- ),
- 'entities' => array(
- 'description' => 'The entities for this field.',
- 'type' => 'blob',
- 'not null' => FALSE,
- 'size' => 'big',
- 'serialize' => TRUE,
- ),
- 'ui_limit' => array(
- 'description' => 'The UI limit for this field.',
- 'type' => 'blob',
- 'not null' => FALSE,
- 'size' => 'big',
- 'serialize' => TRUE,
- ),
- 'properties' => array(
- 'description' => 'The properties for this field.',
- 'type' => 'blob',
- 'not null' => FALSE,
- 'size' => 'big',
- 'serialize' => TRUE,
- ),
- ),
- 'primary key' => array('field'),
- );
- return $schema;
- }
- /**
- * Add the ui_limit table to the fields table.
- */
- function ds_update_7201() {
- $schema = ds_schema();
- if (!db_field_exists('ds_fields', 'ui_limit')) {
- db_add_field('ds_fields', 'ui_limit', $schema['ds_fields']['fields']['ui_limit']);
- }
- }
- /**
- * Increase the label storage length to 128.
- */
- function ds_update_7202() {
- db_change_field('ds_fields', 'label', 'label',
- array(
- 'description' => 'The label of the field.',
- 'type' => 'varchar',
- 'length' => 128,
- 'not null' => TRUE,
- 'default' => '',
- ));
- }
- /**
- * Increase the view_mode storage length to 64
- */
- function ds_update_7203() {
- db_change_field('ds_field_settings', 'view_mode', 'view_mode',
- array(
- 'description' => 'The name of the view_mode.',
- 'type' => 'varchar',
- 'length' => 64,
- 'not null' => TRUE,
- 'default' => '',
- )
- );
- db_change_field('ds_layout_settings', 'view_mode', 'view_mode',
- array(
- 'description' => 'The name of the view_mode.',
- 'type' => 'varchar',
- 'length' => 64,
- 'not null' => TRUE,
- 'default' => '',
- )
- );
- db_change_field('ds_view_modes', 'view_mode', 'view_mode',
- array(
- 'description' => 'The machine name of the view mode.',
- 'type' => 'varchar',
- 'length' => 64,
- 'not null' => TRUE,
- 'default' => '',
- )
- );
- }
|