You are here

function nd_nd_build_alter in Node displays 6.3

Same name and namespace in other branches
  1. 6.2 nd.module \nd_nd_build_alter()

Implements hook_nd_build_alter

File

./nd.module, line 178
Node displays.

Code

function nd_nd_build_alter($node) {

  /**
   * Stickied Teasers
   *
   * Use of sticky as a stand-alone buildmode will be deprecated in 3.x,
   * where it will be replaced with custom variant selection.
   * For the time being, sticky can be ignored by setting
   * $conf['ds_ignore_sticky'] = TRUE
   * in settings.php
   */
  if (variable_get('ds_ignore_sticky', FALSE) != TRUE) {
    if ($node->build_mode == 'teaser' && $node->sticky == 1) {
      $node->build_mode = 'sticky';
    }
  }

  /**
   * Switch buildmode based on query string
   *
   * Build modes can be changed by setting ?build_mode=name in the query
   * string. Becuase this is potentially insecure, developers must enable
   * this for specific build modes by setting which modes allow switching
   * in a variable 'nd_parameter_switch_bm'.
   */
  $parameter_build_modes = variable_get('nd_parameter_switch_bm', array());
  if (isset($_GET['build_mode'])) {
    $switch = check_plain($_GET['build_mode']);
    if (in_array($switch, $parameter_build_modes)) {
      $node->build_mode = $switch;
    }
  }
}