You are here

function color_rebuilder_drush_color_rebuild in Color Rebuilder 7

1 call to color_rebuilder_drush_color_rebuild()
drush_color_rebuilder_color_rebuild in ./color_rebuilder.drush.inc
Callback for the drush-demo-command command

File

./color_rebuilder.module, line 180

Code

function color_rebuilder_drush_color_rebuild($main_color = NULL) {
  $theme_to_rebuild = drush_get_option('theme', 1);
  $schema_color = drush_get_option('color', 1);
  $error = color_rebuilder_rebuild($theme_to_rebuild, $schema_color);
  switch ($error) {

    // no error, the theme has been rebuilt
    case 0:
      drupal_set_message(t("The '@theme' color cache has been rebuilt with the scheme color '@scheme'", array(
        '@theme' => $theme_to_rebuild,
        '@scheme' => $schema_color,
      )));
      break;

    // error 1, color is not enabled
    case 1:
      drush_set_error(dt("The color module is not enabled"));
      break;

    // error 2, theme hasn't color
    case 2:
      drush_set_error(dt("The theme '@theme' hasn't the color-enabled", array(
        '@theme' => $theme_to_rebuild,
      )));
      break;

    // error 3, no color scheme
    case 3:
      drush_set_error(dt("The theme '@theme' hasn't the color scheme '@scheme' ", array(
        '@theme' => $theme_to_rebuild,
        '@scheme' => $schema_color,
      )));
      break;

    // theme doesn't exist
    case 4:
      drush_set_error(dt("The theme '@theme' doesn't exist", array(
        '@theme' => $theme_to_rebuild,
      )));
      break;
  }
}