function gallery_assist_install in Gallery Assist 6
Same name and namespace in other branches
- 7 gallery_assist.install \gallery_assist_install()
Implementation of hook_install().
File
- ./
gallery_assist.install, line 326 - Install, update and uninstall functions and DB tables for the Gallery Assist module.
Code
function gallery_assist_install() {
drupal_install_schema('gallery_assist');
// Set default gallery_assist variables.
variable_set('gallery_assist_directory', file_directory_path() . '/gallery_assist');
$dir = variable_get('gallery_assist_directory', FALSE);
// Create default GA directory.
if (!file_check_directory($dir, 1)) {
drupal_set_message(t('It was not possible to create the gallery_assist directory. The files directory must be writable. Clarify the write permissions for the files folder and reinstall the module Gallery Assist.'), 'error');
}
else {
$path = variable_get('gallery_assist_directory', FALSE) . '/' . 1;
file_check_directory($path, 1);
watchdog('info', t('Gallery enviroment for the "super-admin" was created successfull.'));
global $user;
if ($user->uid != 1) {
$path = $settings['ga']['ga_directory'] . '/' . $user->uid;
file_check_directory($path, 1);
watchdog('info', t('Gallery enviroment for user @user was created successfull.', array(
'@user',
$user->name,
)));
}
}
// Set the default variables and default values for gallery assist and/or node types with assignment.
// The default values will be assigned to each new gallery_assist asigment.
// You can set as desired others default values here before installing this module.
$ga_variables = array(
'upload_thm' => 150,
'upload_prev' => 550,
'items_per_row' => 3,
'rows_per_page' => 2,
'thumbnail_size' => 100,
'thumbnail_size_plus' => 0,
'preview_size' => 550,
'item_margin' => 10,
'item_padding' => 20,
'item_border' => 1,
'item_border_color' => '#cbe2f1',
'show_backlink' => 0,
'show_toggle' => 0,
'position_toggle' => 0,
'title_substr' => 16,
'pager_symbol' => 0,
'pager_layout' => 'default',
'pager_position' => 'top',
'pager_visibles' => 3,
// Update 1
'show_title' => 0,
'show_layout' => 'grid',
//'layout' => array(
'ga_align' => 'center',
'gap_align' => 'center',
't_ga_float' => 'none',
'p_ga_float' => 'none',
//),
'shadow' => 0,
// Update 3
'hide_in_teaser' => FALSE,
'show_download_link' => FALSE,
'item_effect' => FALSE,
'max_items' => FALSE,
'max_form_items' => 6,
//'validate_upload' => array(
'file_size' => '',
'user_size' => '',
'resolution' => 0,
'extensions' => 'jpg jpeg gif png',
//),
'ga_public_status' => 2,
'admin_public_status' => FALSE,
'pager_t_height' => 20,
'pager_t_active_height' => 25,
// User permissions.
'extra_layout_settings_allowed' => 0,
'common_settings_allowed' => 0,
'hide_teaser_container_allowed' => 0,
'display_download_link_allowed' => 0,
'container_format_allowed' => 0,
'gallery_container_weight_allowed' => 0,
'show_in_homepage_block_allowed' => 0,
'gallery_public_status_allowed' => 0,
'show_titles_allowed' => 0,
'show_in_userprofile_allowed' => 0,
'gallery_items_shadow_allowed' => 0,
// DB
'ga_db_order_field' => 'a.weight',
'ga_db_order' => 'ASC',
// Update 5
'ga_item_title_type' => 0,
'pager_align' => 'center',
// Update 6
't_thm_link_format' => 'item',
'ga_pager_show_pages' => TRUE,
'ga_cover_sticky' => 1,
);
// Set the default variables and default values for gallery assist block gallery..
$ga_block_variables = array(
0 => array(
'bformat' => 'pic',
'item_size' => 50,
'item_margin' => 1,
'item_padding' => 0,
'item_border' => 0,
'item_border_color' => '#027AC6',
'visibles' => 6,
),
1 => array(
'bformat' => 'lnk',
'item_size' => 50,
'block_item_margin' => 1,
'block_item_padding' => 0,
'item_border' => 0,
'item_border_color' => '#027AC6',
'visibles' => 6,
),
2 => array(
'gallery' => '',
'item_size' => 50,
'item_margin' => 1,
'item_padding' => 0,
'item_border' => 0,
'item_border_color' => '#027AC6',
'visibles' => 6,
'order' => 'DESC',
),
);
// One of the basic features of this module is the assign gallery-funktionality.
// The set the variable at this point is the best method to develop efecctiv and simplified module code.
// (I mean with this the Assignment-Functionality)
variable_set('gallery_assist_default', 1);
variable_set('gallery_assist_default_data', $ga_variables);
variable_set('gallery_assist_gallery_assist', 1);
variable_set('gallery_assist_gallery_assist_data', $ga_variables);
variable_set('gallery_assist_block_data', $ga_block_variables);
variable_set('gallery_assist_editform_pager_limit', 10);
variable_set('gallery_assist_forms_possition', -2);
}