You are here

function omega_tools_theme_export in Omega Tools 7.3

@todo

1 string reference to 'omega_tools_theme_export'
omega_tools_menu in ./omega_tools.module
Implements hook_menu().

File

includes/omega_tools.admin.inc, line 41

Code

function omega_tools_theme_export($form, &$form_state, $theme) {
  $form_state['theme'] = $theme;
  $info = drupal_parse_info_file(drupal_get_path('theme', $theme) . '/' . $theme . '.info');
  $settings = isset($info['settings']) ? $info['settings'] : array();
  $settings = variable_get('theme_' . $theme . '_settings', $settings);
  $editable = _omega_tools_is_editable($theme);
  $form['settings'] = array(
    '#type' => 'textarea',
    '#title' => t('Theme settings'),
    '#description' => $editable ? t('You may now edit the theme settings before proceeding with the export and eventually saving them to the .info file of your theme. The theme settings provided in this form will be written into the .info file of the %name theme. All settings that are currently present in that file will be overwritten.', array(
      '%name' => $info['name'],
    )) : t("This theme is not editable and therefore you won't be able to export the theme settings automatically."),
    '#default_value' => omega_tools_build_info_file($settings, 'settings'),
    '#rows' => 30,
    '#element_validate' => array(
      '_omega_tools_validate_theme_settings',
    ),
  );
  $form['revert'] = array(
    '#type' => 'checkbox',
    '#title' => t('Revert theme settings'),
    '#description' => t('This will purge the theme settings from the database after exporting them to the .info file of this theme.'),
    '#default_value' => TRUE,
    '#access' => $editable,
  );
  $form['actions']['#type'] = 'actions';
  $form['actions']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Export'),
    '#access' => $editable,
  );
  $form['actions']['cancel'] = array(
    '#markup' => l(t('Cancel'), 'admin/appearance/settings/' . $theme),
  );
  return $form;
}