View source
<?php
function accordions_schema() {
$schema = array();
$schema['accordions'] = array(
'description' => 'Details of accordions',
'fields' => array(
'type' => array(
'description' => 'Type of accordion group.',
'type' => 'varchar',
'length' => 32,
'not null' => TRUE,
),
'subtype' => array(
'description' => 'Subtype of accordion group.',
'type' => 'varchar',
'length' => 32,
'not null' => FALSE,
),
'id' => array(
'description' => 'ID of accordion group within type/subtype.',
'type' => 'varchar',
'length' => 32,
'not null' => TRUE,
),
'name' => array(
'description' => 'Name of accordion group.',
'type' => 'varchar',
'length' => 32,
'not null' => TRUE,
),
'initial' => array(
'description' => 'Binary flag to indicate whether the item should initially be expanded or not.',
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
'default' => 0,
),
),
'primary key' => array(
'type',
'subtype',
'id',
),
'indexes' => array(
'ti' => array(
'type',
'id',
),
),
);
return $schema;
}
function accordions_install() {
user_role_grant_permissions(DRUPAL_AUTHENTICATED_RID, array(
'configure accordion items',
));
}
function accordions_enable() {
drupal_set_message(t('<a href="!link">Configure the allowed types of accordions</a> and then edit/configure some content of those types to make them into accordions.', array(
'!link' => url('admin/config/user-interface/accordions'),
)), 'warning');
}
function accordions_uninstall() {
variable_del('accordions_enabled_types');
}