You are here

function ds_test_node_view in Display Suite 7

Same name and namespace in other branches
  1. 7.2 tests/ds_test.module \ds_test_node_view()

Implements hook_node_view().

File

tests/ds_test.module, line 65
Display Suite test module.

Code

function ds_test_node_view($node, $view_mode, $langcode) {
  $node->content['ds_extras_extra_test_field'] = array(
    '#markup' => 'This is an extra field made available through "Extra fields" functionality.',
    '#weight' => 10,
  );

  // Check whether the heavy extra field is rendered or not.
  if ($node->type == 'article') {
    $fields = field_extra_fields_get_display('node', 'article', $view_mode);
    if (isset($fields['heavy_field']) && $fields['heavy_field']['visible']) {
      $node->content['heavy_field'] = array(
        '#markup' => 'Heavy field',
        '#weight' => $fields['heavy_field']['weight'],
      );
    }
  }
}