view_mode_page.install in View Mode Page 8
Same filename and directory in other branches
Install the DB table for the View Mode Page module
File
view_mode_page.installView source
<?php
/**
* @file
* Install the DB table for the View Mode Page module
*/
/**
* Just return the current schema
* @return array
*/
function view_mode_page_module_schema() {
$schema = array();
$schema['view_mode_page'] = array(
'fields' => array(
'content_type' => array(
'type' => 'varchar',
'length' => 55,
'not null' => TRUE,
),
'view_mode' => array(
'type' => 'varchar',
'length' => 55,
'not null' => TRUE,
),
'url_pattern' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
),
'show_title' => array(
'type' => 'int',
'default' => 0,
),
'title' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
),
'primary key' => array(
'content_type',
'view_mode',
'url_pattern',
),
);
return $schema;
}
/**
* Implements hook_schema().
*/
function view_mode_page_schema() {
return view_mode_page_module_schema();
}
/**
* Add title and show title fields.
*/
function view_mode_page_update_7100() {
$schema = view_mode_page_module_schema();
db_add_field('view_mode_page', 'show_title', $schema['view_mode_page']['fields']['show_title']);
db_add_field('view_mode_page', 'title', $schema['view_mode_page']['fields']['title']);
}
Functions
Name | Description |
---|---|
view_mode_page_module_schema | Just return the current schema |
view_mode_page_schema | Implements hook_schema(). |
view_mode_page_update_7100 | Add title and show title fields. |