You are here

function themekey_ui_node_update in ThemeKey 7

Same name and namespace in other branches
  1. 7.3 themekey_ui.module \themekey_ui_node_update()
  2. 7.2 themekey_ui.module \themekey_ui_node_update()

Implementation of hook_node_update

Parameters

unknown_type $node:

File

./themekey_ui.module, line 317
ThemeKey UI is an extension for ThemeKey

Code

function themekey_ui_node_update($node) {
  if (!empty($node->themekey_ui_theme)) {
    if (!$node->revision && 0 < db_select('themekey_ui_node_theme', 't')
      ->fields('t')
      ->condition('nid', $node->nid)
      ->condition('vid', $node->vid)
      ->execute()
      ->rowCount()) {

      // UPDATE
      $query = db_update('themekey_ui_node_theme')
        ->fields(array(
        'nid' => $node->nid,
        'vid' => $node->vid,
        'theme' => $node->themekey_ui_theme,
      ));
      $query
        ->condition('nid', $node->nid, '=');
      $query
        ->condition('vid', $node->vid, '=');
      $query
        ->execute();
    }
    else {

      // INSERT
      themekey_ui_node_insert($node);
    }
  }
}