You are here

function themekey_ui_node_load in ThemeKey 7.3

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

Implements hook_node_load().

Parameters

$nodes:

$types:

1 call to themekey_ui_node_load()
themekey_ui_nid2theme in ./themekey_ui.module
This function implements the interface of a ThemeKey mapping function, but doesn't set a ThemeKey property's value. It sets the Drupal static themekey_custom_theme which will cause ThemeKey to use this theme.

File

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

Code

function themekey_ui_node_load($nodes, $types) {
  if (!empty($nodes)) {
    foreach ($nodes as $nid => $node) {
      if (variable_get('themekey_ui_nodeform', 0) && variable_get('themekey_ui_nodeform|' . $node->type, 1)) {
        if (!empty($node->vid)) {
          $theme = db_select('themekey_ui_node_theme', 't')
            ->fields('t', array(
            'theme',
          ))
            ->condition('nid', $node->nid)
            ->condition('vid', $node->vid)
            ->execute()
            ->fetchField();
          if ($theme) {
            $node->themekey_ui_theme = $theme;
          }
          else {
            $node->themekey_ui_theme = 'default';
          }
        }
      }
    }
  }
}