You are here

function content_theme_admin_content_node_submit in Content Theme 7

Same name and namespace in other branches
  1. 6 content_theme.admin.inc \content_theme_admin_content_node_submit()
  2. 7.2 content_theme.admin.inc \content_theme_admin_content_node_submit()

File

./content_theme.admin.inc, line 112
Admin page callbacks for the content_theme module.

Code

function content_theme_admin_content_node_submit($form, &$form_state) {
  $edit_theme = $form_state['values']['content_theme_edit'];
  $view_theme = $form_state['values']['content_theme_view'];
  foreach ($form_state['values']['nodes'] as $nid) {
    if (!empty($nid)) {
      if ($edit_theme != '-no_update-') {
        db_delete('content_theme_node')
          ->condition('nid', $nid)
          ->condition('action', 'edit')
          ->execute();
        if ($edit_theme != '-content_type-') {
          db_insert('content_theme_node')
            ->fields(array(
            'nid' => $nid,
            'action' => 'edit',
            'theme' => $edit_theme,
          ))
            ->execute();
        }
      }
      if ($view_theme != '-no_update-') {
        db_delete('content_theme_node')
          ->condition('nid', $nid)
          ->condition('action', 'view')
          ->execute();
        if ($view_theme != '-content_type-') {
          db_insert('content_theme_node')
            ->fields(array(
            'nid' => $nid,
            'action' => 'view',
            'theme' => $view_theme,
          ))
            ->execute();
        }
      }
    }
  }
  drupal_set_message(t('The themes have been updated.'));
  cache_clear_all();
}