You are here

function themekey_ui_settings_form_validate in ThemeKey 7.3

Same name and namespace in other branches
  1. 7.2 themekey_ui_admin.inc \themekey_ui_settings_form_validate()

Validation of

See also

themekey_ui_settings_form()

File

./themekey_ui_admin.inc, line 104

Code

function themekey_ui_settings_form_validate(&$form, $form_state) {
  if (array_key_exists('themekey_ui_blog_author', $form_state['values'])) {
    if ($form_state['values']['themekey_ui_blog_author'] && !$form_state['values']['themekey_ui_author']) {
      form_set_error('themekey_ui_blog_author', t('"%themekey_ui_blog_author" requires "%themekey_ui_author" to be active.', array(
        '%themekey_ui_blog_author' => t('Let the user select a theme for her blog pages'),
        '%themekey_ui_author' => t('Let the user select a theme for her nodes in her user profile'),
      )));
    }
  }
  $selectable_themes = array_diff($form_state['values']['themekey_ui_selectable_themes'], array(
    '0',
  ));
  if (empty($selectable_themes)) {
    if (array_key_exists('themekey_ui_pathalias', $form_state['values']) && $form_state['values']['themekey_ui_pathalias'] || $form_state['values']['themekey_ui_nodeform'] || $form_state['values']['themekey_ui_author'] || array_key_exists('themekey_ui_blog_author', $form_state['values']) && $form_state['values']['themekey_ui_blog_author']) {
      form_set_error('themekey_ui_selectable_themes', t('You need to activate at least one selectable theme.'));
    }
  }
}