You are here

function nd_nd_fields in Node displays 6

Implementation of hook_nd_fields().

File

./nd.module, line 575
Main node displays file.

Code

function nd_nd_fields($node_type, $has_body, $build_mode) {
  $fields = array(
    'title' => array(
      'title' => t('Title'),
      'formatters' => array(
        'nd_title_h1_nolink' => t('H1 title'),
        'nd_title_h1_link' => t('H1 title, linked to node'),
        'nd_title_h2_nolink' => t('H2 title'),
        'nd_title_h2_link' => t('H2 title, linked to node'),
        'nd_title_h2_block_nolink' => t('H2 block title'),
        'nd_title_h2_block_link' => t('H2 block title, linked to node'),
        'nd_title_p_nolink' => t('Paragraph title'),
        'nd_title_p_link' => t('Paragraph title, linked to node'),
      ),
      'type' => ND_FIELD_THEME,
    ),
    'author' => array(
      'title' => t('Author'),
      'formatters' => array(
        'nd_author_nolink' => t('Author'),
        'nd_author_link' => t('Author linked to profile'),
      ),
      'type' => ND_FIELD_THEME,
    ),
    'links' => array(
      'title' => t('Links'),
      'type' => ND_FIELD_PREPROCESS,
    ),
    'read_more' => array(
      'title' => t('Read more'),
      'code' => '<?php echo l(t("Read more"), "node/$node->nid"); ?>',
      'type' => ND_FIELD_OVERRIDABLE,
    ),
    'post_date' => array(
      'title' => t('Post date'),
      'code' => '<?php echo format_date($node->created, "custom", "d/m/Y"); ?>',
      'type' => ND_FIELD_OVERRIDABLE,
    ),
  );

  // Check for body.
  if ($has_body == TRUE) {
    $fields['body'] = array(
      'title' => t('Core body'),
      'formatters' => array(
        'nd_bodyfield' => t('Body'),
      ),
      'type' => ND_FIELD_THEME,
    );
  }
  if (module_exists('taxonomy')) {
    $fields['terms'] = array(
      'title' => t('Taxonomy'),
      'type' => ND_FIELD_PREPROCESS,
    );
  }
  if (module_exists('upload') && $build_mode != 'teaser' && variable_get("upload_{$node_type}", 1)) {
    $fields['files'] = array(
      'title' => t('Core upload'),
      'type' => ND_FIELD_IGNORE,
    );
  }
  return $fields;
}