function hook_environment in Environment 7
Same name and namespace in other branches
- 6 environment.api.php \hook_environment()
Declare additional environments.
This hook is to facilitate UI building and restricting environment switch to known environments.
Return value
array Array of environment names in the format:
- label: Human-readable name for the environment.
- description: Description of the environment and it's purpose.
- workflow: Tag the state with the machine name of the environment workflow.
- allowed: Central definition of permitted operations for the environment_allowed() function. Default FALSE indicates that something should not happen, such as show the user a debugging message. Different categories can be specified for different rulesets.
See also
environment_allowed
3 functions implement hook_environment()
Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.
- environment_drush_render_environment in ./
environment.drush.inc - Render the specified environment definition as a descriptive one-liner.
- environment_environment in ./
environment.module - Implements hook_environment().
- environment_readonly_environment in modules/
environment_readonly/ environment_readonly.module - Implements hook_environment().
1 invocation of hook_environment()
- environment_load in ./
environment.module - Fetches all available environments.
File
- ./
environment.api.php, line 77 - Hooks provided by Environment.
Code
function hook_environment() {
$environments = array();
$environments['stage'] = array(
'label' => t('Staging'),
'description' => t('Staging sites are for content creation before publication.'),
'allowed' => array(
'default' => FALSE,
'email' => FALSE,
),
);
$environment['internal'] = array(
'label' => t('Internal-only site'),
'description' => t('Internal sites are not available for live access.'),
'workflow' => 'public',
);
$environment['live'] = array(
'label' => t('Live site'),
'description' => t('Live sites are in full production and browsable on the web.'),
'workflow' => 'public',
);
return $environments;
}