You are here

function set_theme_properties in Patterns 7.2

Wraps the call to drupal_form_submit to set the theme properties.

Parameters

string $form_id String containing the form ID. In the case of custom functions the value is empty.:

array $form_state Set of values after parsing the action.:

1 string reference to 'set_theme_properties'
system_patterns in patterns_components/components/system.inc
Implements hook_patterns().

File

patterns_components/components/system.inc, line 573

Code

function set_theme_properties($form_id, &$form_state) {

  //At this point we can ensure there is a theme value, since is part of the mandatory syntactic analysis
  $theme = $form_state['values']['value'];

  //Enable or disable the if there is any valid value in status
  if (isset($form_state['values']['status']) && $form_state['values']['status'] == TRUE) {
    theme_enable(array(
      $theme,
    ));
  }
  else {
    if (isset($form_state['values']['status']) && $form_state['values']['status'] == FALSE) {
      theme_disable(array(
        $theme,
      ));
    }
  }

  //Set this theme as default if default is set and is true
  if (isset($form_state['values']['default']) && $form_state['values']['default']) {
    variable_set('theme_default', $theme);
  }

  //Set this theme as administrative if admin is set and is true
  if (isset($form_state['values']['admin']) && $form_state['values']['admin']) {
    variable_set('admin_theme', $theme);
  }
  $msg = t('Properties(s) of theme %theme updated.', array(
    '%theme' => $theme,
  ));
  return patterns_results(PATTERNS_SUCCESS, $msg);
}