_node_type_set_defaults

Versions
5 – 6
_node_type_set_defaults($info)

Set default values for a node type defined through hook_node_info().

▾ 4 functions call _node_type_set_defaults()

default_profile_final in profiles/default/default.profile
Perform any final installation tasks for this profile.
node_type_reset in modules/node/content_types.inc
Resets all of the relevant fields of a module-defined node type to their default values.
system_update_1005 in modules/system/system.install
_node_types_build in modules/node/node.module
Builds and returns the list of available node types.

Code

modules/node/node.module, line 424

<?php
function _node_type_set_defaults($info) {
  if (!isset($info['has_title'])) {
    $info['has_title'] = TRUE;
  }
  if ($info['has_title'] && !isset($info['title_label'])) {
    $info['title_label'] = t('Title');
  }

  if (!isset($info['has_body'])) {
    $info['has_body'] = TRUE;
  }
  if ($info['has_body'] && !isset($info['body_label'])) {
    $info['body_label'] = t('Body');
  }

  if (!isset($info['help'])) {
    $info['help'] = '';
  }
  if (!isset($info['min_word_count'])) {
    $info['min_word_count'] = 0;
  }
  if (!isset($info['custom'])) {
    $info['custom'] = FALSE;
  }
  if (!isset($info['modified'])) {
    $info['modified'] = FALSE;
  }
  if (!isset($info['locked'])) {
    $info['locked'] = TRUE;
  }

  $info['orig_type'] = $info['type'];
  $info['is_new'] = TRUE;

  return $info;
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.