View source
<?php
const MINIMUM_CORE = '7.56';
if (!function_exists("system_form_install_configure_form_alter")) {
function system_form_install_configure_form_alter(&$form, $form_state) {
$form['site_information']['site_name']['#default_value'] = 'express';
}
}
if (!function_exists("system_form_install_select_profile_form_alter")) {
function system_form_install_select_profile_form_alter(&$form, $form_state) {
foreach ($form['profile'] as $key => $element) {
$form['profile'][$key]['#value'] = 'express';
}
}
}
function express_install_tasks() {
$tasks = array();
$tasks['express_profile_configure_form'] = array(
'display_name' => st('Configure Express profile'),
'type' => 'form',
);
$tasks['express_final'] = array();
return $tasks;
}
function express_profile_configure_form() {
$form = array();
$options = array(
'cu_core' => st('Production'),
'cu_testing_core' => st('Testing'),
'cu_pantheon_core' => st('Pantheon'),
);
$form['express_core_version'] = array(
'#type' => 'radios',
'#title' => st('Which version of Express would you like to install?'),
'#description' => st('Testing will include the "cu_testing_core" module while "Production" will include the "cu_core" module.'),
'#options' => $options,
'#default_value' => 'cu_core',
);
$form['actions'] = array(
'#type' => 'actions',
);
$form['actions']['submit'] = array(
'#type' => 'submit',
'#value' => st('Create and Finish'),
'#weight' => 15,
);
return $form;
}
function express_profile_configure_form_submit(&$form, &$form_state) {
variable_set('express_core_version', $form_state['values']['express_core_version']);
}
function express_final() {
module_enable(array(
'entityreference',
));
module_enable(array(
'express_layout',
));
global $databases;
$plus = $databases['default']['default']['database'];
variable_set('site_mail', 'cudrupal+' . $plus . '@gmail.com');
$update = db_update('block')
->fields(array(
'status' => 1,
'region' => 'content',
'weight' => 0,
))
->condition('module', 'system')
->condition('delta', 'main')
->execute();
db_query("UPDATE {block} SET title = '<none>' WHERE delta = 'site_navigation_menus-1'");
db_query("UPDATE {block} SET title = '<none>' WHERE delta = 'site_navigation_menus-4'");
module_disable(array(
'update',
));
theme_disable(array(
'bartik',
));
module_enable(array(
'secure_permissions',
));
drupal_static_reset();
module_enable(array(
'express_permissions',
));
if ($core = variable_get('express_core_version', '')) {
module_enable(array(
$core,
));
}
profile_module_manager_add_to_ignore(array(
'entityreference',
'express_layout',
'secure_permissions',
'express_permissions',
));
$types = node_type_get_names();
variable_set('dnmi_content_types', array_flip($types));
drupal_flush_all_caches();
secure_permissions_rebuild();
}
function express_themes_enabled() {
$query = db_update('block')
->fields(array(
'region' => '-1',
'status' => '0',
))
->execute();
$query = db_update('block')
->fields(array(
'region' => 'content',
'status' => '1',
))
->condition('delta', 'main')
->execute();
$query = db_update('block')
->fields(array(
'region' => 'help',
'status' => '1',
))
->condition('delta', 'help')
->execute();
}
function express_node_type_insert($info) {
if (!in_array($info->type, $types = variable_get('dnmi_content_types', array()))) {
$types[$info->type] = $info->type;
variable_set('dnmi_content_types', $types);
}
}
function express_node_type_delete($info) {
if (in_array($info->type, $types = variable_get('dnmi_content_types', array()))) {
unset($types[$info->type]);
variable_set('dnmi_content_types', $types);
}
}
function express_menu_alter(&$items) {
$items['admin/people']['title'] = 'Users';
}
function express_get_node_thumbnail($node, $field, $image_style = 'medium') {
$node_field = $node->{$field};
if (!empty($node_field)) {
$image['alt'] = $node_field[LANGUAGE_NONE][0]['alt'];
$image['path'] = image_style_url($image_style, $node_field[LANGUAGE_NONE][0]['uri']);
$image['uri'] = image_style_path($image_style, $node_field[LANGUAGE_NONE][0]['uri']);
if (!file_exists($image['uri'])) {
image_style_create_derivative(image_style_load('medium'), $node_field[LANGUAGE_NONE][0]['uri'], $image['uri']);
}
$image['info'] = image_get_info($image['uri']);
}
return $image;
}