brainstorm_profile.profile in Brainstorm profile 7
Same filename and directory in other branches
Enables modules and site configuration for a standard site installation.
File
brainstorm_profile.profileView source
<?php
/**
* @file
* Enables modules and site configuration for a standard site installation.
*/
/**
* Implements hook_form_alter() for install_select_profile_form().
*
* Select the current install profile by default.
*/
function system_form_install_select_profile_form_alter(&$form, $form_state) {
if (!function_exists("system_form_alter")) {
foreach ($form['profile'] as $profile_name => $profile_data) {
$form['profile'][$profile_name]['#value'] = 'brainstorm_profile';
}
}
}
/**
* Implements hook_install_tasks().
*/
function brainstorm_profile_install_tasks($install_state) {
$tasks = array();
$tasks['brainstorm_profile_custom_settings'] = array(
'display' => FALSE,
);
$tasks['brainstorm_profile_blocks_turning'] = array(
'display' => FALSE,
);
return $tasks;
}
/**
* Implements hook_install_tasks_alter().
*/
function brainstorm_profile_install_tasks_alter(&$tasks, $install_state) {
foreach ($install_state as $state) {
if ($state === 'install_bootstrap_full') {
$source = 'profiles/brainstorm_profile/node_export_assets/';
$res = variable_get('file_public_path', conf_path() . '/files');
brainstorm_profile_recurse_copy($source, $res);
drupal_get_messages();
}
}
}
/**
* Our custom task. Custom settings help to display content correctly.
*
* @param array $install_state
* An array of information about the current installation state.
*
* @throws \Exception
*/
function brainstorm_profile_custom_settings(array $install_state) {
$node = node_load(56);
if (!empty($node)) {
$node->path = array(
'alias' => 'about-us',
'pathauto' => FALSE,
'language' => 'und',
);
node_save($node);
}
$node = node_load(51);
if (!empty($node)) {
$node->path = array(
'alias' => 'contact-us',
'pathauto' => FALSE,
'language' => 'und',
);
node_save($node);
}
$node = node_load(6);
if (!empty($node)) {
$node->path = array(
'alias' => 'typography',
'pathauto' => FALSE,
'language' => 'und',
);
node_save($node);
}
$view = views_get_view('testimonials');
$view->style_plugin->options['instance'] = 'owlcarousel_settings_testimonials';
$view
->save();
$brainstorm_settings = variable_get('theme_brainstorm_theme_settings', array());
$brainstorm_settings['toggle_logo'] = 1;
$brainstorm_settings['toggle_name'] = 0;
variable_set('theme_brainstorm_theme_settings', $brainstorm_settings);
}
/**
* Our custom task. Enable and turning blocks.
*
* @param array $install_state
* An array of information about the current installation state.
*/
function brainstorm_profile_blocks_turning(array $install_state) {
$modules = array();
if (!module_exists('feature_carousel')) {
$modules[] = 'feature_carousel';
}
if (!module_exists('feature_block')) {
$modules[] = 'feature_block';
}
if (!module_exists('feature_menu')) {
$modules[] = 'feature_menu';
}
if (!empty($modules)) {
module_enable($modules);
}
}
/**
* Recursive copy.
*
* @param string $src
* - Source folder with files.
* @param string $dst
* - Destination folder.
*/
function brainstorm_profile_recurse_copy($src, $dst) {
$dir = opendir($src);
@mkdir($dst);
while (FALSE !== ($file = readdir($dir))) {
if ($file != '.' && $file != '..') {
if (is_dir($src . '/' . $file)) {
brainstorm_profile_recurse_copy($src . '/' . $file, $dst . '/' . $file);
}
else {
copy($src . '/' . $file, $dst . '/' . $file);
}
}
}
closedir($dir);
}
Functions
Name | Description |
---|---|
brainstorm_profile_blocks_turning | Our custom task. Enable and turning blocks. |
brainstorm_profile_custom_settings | Our custom task. Custom settings help to display content correctly. |
brainstorm_profile_install_tasks | Implements hook_install_tasks(). |
brainstorm_profile_install_tasks_alter | Implements hook_install_tasks_alter(). |
brainstorm_profile_recurse_copy | Recursive copy. |
system_form_install_select_profile_form_alter | Implements hook_form_alter() for install_select_profile_form(). |