Commit 40fe1e58 authored by Philippe Mouchel's avatar Philippe Mouchel
Browse files

Drupal 7 version

parent d931dcc0
......@@ -16,6 +16,10 @@ function env_conf_form() {
// List available environments
$available_envs = _get_simple_available_environments();
if (!$available_envs) {
drupal_set_message(t('No environment is defined. You should define one or more by implementing <strong>hook_env_conf_available_env()</strong>.'), 'warning');
return $form;
}
// Get current environment name (normally in settings.php,
// but possibly in a Drupal variable,
......
name = Per-environment configuration
description = Allow admin to deploy specific configuration per environment, by using a Drush command or an admin page
core = 6.x
core = 7.x
......@@ -7,11 +7,16 @@
*/
/**
* Implements hook_perm().
* Implements hook_permission().
*/
function env_conf_perm() {
function env_conf_permission() {
return array(
'access deploy-configuration feature',
'access deploy-configuration feature' => array(
'title' => t('Access deploy configuration feature'),
'description' => t('Access to admin page where you can deploy a selected environment configuration.'),
'restrict access' => TRUE,
'warning' => 'Only admins should access this feature.',
),
);
}
......@@ -20,7 +25,7 @@ function env_conf_perm() {
*/
function env_conf_menu() {
return array(
'admin/settings/environment-configuration' => array(
'admin/config/environment-configuration' => array(
'title' => 'Per-environment configuration',
'description' => 'Page where you can deploy a selected environment configuration.',
'page callback' => 'drupal_get_form',
......@@ -30,3 +35,44 @@ function env_conf_menu() {
)
);
}
/**
* Implements hook_env_conf_available_env().
*/
function env_conf_env_conf_available_env() {
return array(
'local' => array(
'callbacks' => array(
'_demo_env_conf',
),
'include_file' => array(
'type' => 'inc',
'module' => 'env_conf',
'name' => 'env_conf.env_conf',
),
'weight' => 1,
),
'staging' => array(
'callbacks' => array(
'_demo_env_conf',
),
'include_file' => array(
'type' => 'inc',
'module' => 'env_conf',
'name' => 'env_conf.env_conf',
),
'weight' => 2,
),
'prod' => array(
'callbacks' => array(
'_demo_env_conf',
),
'include_file' => array(
'type' => 'inc',
'module' => 'env_conf',
'name' => 'env_conf.env_conf',
),
'weight' => 3,
),
);
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment