You are here

function content_theme_node_insert in Content Theme 7

Same name and namespace in other branches
  1. 7.2 content_theme.module \content_theme_node_insert()

Implements hook_node_insert().

1 call to content_theme_node_insert()
content_theme_node_update in ./content_theme.module
Implements hook_node_update().

File

./content_theme.module, line 276
This module allows to use different themes than the site default on content creating, editing, and viewing pages.

Code

function content_theme_node_insert($node) {
  $theme = isset($node->content_theme_content_node_edit) ? $node->content_theme_content_node_edit : '-content_type-';
  if ($theme != '-content_type-') {
    db_insert('content_theme_node')
      ->fields(array(
      'nid' => $node->nid,
      'action' => 'edit',
      'theme' => $theme,
    ))
      ->execute();
  }
  $theme = isset($node->content_theme_content_node_view) ? $node->content_theme_content_node_view : '-content_type-';
  if ($theme != '-content_type-') {
    db_insert('content_theme_node')
      ->fields(array(
      'nid' => $node->nid,
      'action' => 'view',
      'theme' => $theme,
    ))
      ->execute();
  }
}