You are here

function drush_stringoverrides_enable in String Overrides 7

Drush Callback; Enable a String Override.

File

./stringoverrides.drush.inc, line 158
Drush interface for String Overrides.

Code

function drush_stringoverrides_enable($original) {

  // Get the available options.
  $language = drush_get_option('language', 'en');
  $context = drush_get_option('context', '');

  // Load the current overrides.
  $disabled = variable_get("locale_custom_disabled_strings_{$language}", array());
  $enabled = variable_get("locale_custom_strings_{$language}", array());

  // Make sure the override exists.
  if (isset($disabled[$context][$original])) {

    // Swap the values.
    $enabled[$context][$original] = $disabled[$context][$original];
    unset($disabled[$context][$original]);
    variable_set("locale_custom_disabled_strings_{$language}", $disabled);
    variable_set("locale_custom_strings_{$language}", $enabled);
    drush_print(dt('The string override has been enabled.'));
  }
  else {
    drush_print(dt('Given disabled string override not found.'));
  }
}