You are here

function nd_theme in Node displays 6.3

Same name and namespace in other branches
  1. 6 nd.module \nd_theme()
  2. 6.2 nd.module \nd_theme()
  3. 7 nd.module \nd_theme()

Implementation of hook_theme().

File

./nd.module, line 362
Node displays.

Code

function nd_theme() {
  $theme_functions = array();

  // Single theming functions.
  $formatters = array(
    'nd_bodyfield',
    'nd_title_h1_nolink',
    'nd_title_h1_link',
    'nd_title_h2_nolink',
    'nd_title_h2_link',
    'nd_title_h2_block_nolink',
    'nd_title_h2_block_link',
    'nd_title_p_nolink',
    'nd_title_p_link',
    'nd_book_add_new_child',
    'nd_book_printer_version',
  );
  foreach ($formatters as $formatter) {
    $theme_functions[$formatter] = array(
      'arguments' => array(
        'node' => NULL,
      ),
    );
  }

  // Post date with Date API.
  if (variable_get('nd_use_date_api', TRUE)) {
    if (module_exists('date_api')) {
      $date_formats = date_get_format_types('', TRUE);
    }
    else {
      $date_formats = array(
        'small' => array(
          'title' => 'Small',
          'type' => 'small',
        ),
        'medium' => array(
          'title' => 'Medium',
          'type' => 'medium',
        ),
        'large' => array(
          'title' => 'Large',
          'type' => 'large',
        ),
      );
    }
    foreach ($date_formats as $formatter) {
      $theme_functions['nd_post_date_' . $formatter['type']] = array(
        'arguments' => array(
          'node' => NULL,
        ),
        'function' => 'theme_nd_post_date',
      );
    }
  }

  // Vocabulary.
  $vocab_formatters = array(
    'nd_terms_per_vocabulary_space',
    'nd_terms_per_vocabulary_linked_space',
    'nd_terms_per_vocabulary_comma',
    'nd_terms_per_vocabulary_linked_comma',
    'nd_terms_per_vocabulary_list',
    'nd_terms_per_vocabulary_linked_list',
  );
  foreach ($vocab_formatters as $formatter) {
    $theme_functions[$formatter] = array(
      'arguments' => array(
        'node' => NULL,
      ),
      'function' => 'nd_terms_per_vocabulary',
    );
  }
  return $theme_functions;
}