First off great module, makes working across multiple environments much less confusing.

My problem arises from trying to create a feature around this module so that I can easily have uniform environment settings across multiple sites. With the way the default environment is created it is stored in code and can't be deleted or controlled with features. The offending code is

function environment_indicator_default_environment_indicator_environment() {
  $export = array();

  $environment = new stdClass();
  $environment->api_version = 1;
  $environment->machine = 'default_environment';
  $environment->name = t('Default environment');
  $environment->regexurl = '.*';
  $environment->settings = array(
    'color' => '#aa3333',
    'text_color' => '#ffffff',
    'weight' => 99,
    'position' => 'top',
    'fixed' => FALSE,
  );
  $export['default_environment'] = $environment;

  return $export;
}

I would think that in one of the install functions we should check if there are any defined environments and if we don't find any we then create this default environment. So we would replace the above function with the function below and call it sometime during install. I haven't looked heavily into how dependent the module is on always having an environment available so this may not be a workable solution.

function create_default_environment() {

  $environment = ctools_export_crud_new('environment_indicator_environment', TRUE);
  $environment->api_version = 1;
  $environment->machine = 'default_environment';
  $environment->name = t('Default environment');
  $environment->regexurl = '.*';
  $environment->settings = array(
    'color' => '#aa3333',
    'text_color' => '#ffffff',
    'weight' => 99,
    'position' => 'top',
    'fixed' => FALSE,
  );

  ctools_export_crud_save('environment_indicator_environment', $environment);
}

Comments

ctrlADel created an issue. See original summary.

e0ipso’s picture

Status: Active » Closed (won't fix)

Version for D7 is unmaintained. I am sorry for the inconvenience.