function node_type_set_defaults

cis7 node.module node_type_set_defaults($info = array())
cle7 node.module node_type_set_defaults($info = array())
elmsmedia7 node.module node_type_set_defaults($info = array())
icor7 node.module node_type_set_defaults($info = array())
meedjum_blog7 node.module node_type_set_defaults($info = array())
mooc7 node.module node_type_set_defaults($info = array())

Sets the default values for a node type.

The defaults are appropriate for a type defined through hook_node_info(), since 'custom' is TRUE for types defined in the user interface, and FALSE for types defined by modules. (The 'custom' flag prevents types from being deleted through the user interface.) Also, the default for 'locked' is TRUE, which prevents users from changing the machine name of the type.

Parameters

$info: (optional) An object or array containing values to override the defaults. See hook_node_info() for details on what the array elements mean. Defaults to an empty array.

Return value

A node type object, with missing values in $info set to their defaults.

7 calls to node_type_set_defaults()
node_type_form in modules/node/content_types.inc
Form constructor for the node type editing form.
node_type_form_submit in modules/node/content_types.inc
Form submission handler for node_type_form().
node_type_reset in modules/node/content_types.inc
Resets relevant fields of a module-defined node type to their default values.
node_type_save in modules/node/node.module
Saves a node type to the database.
standard_install in profiles/standard/standard.install
Implements hook_install().

... See full list

File

modules/node/node.module, line 805
The core that allows content to be submitted to the site. Modules and scripts may programmatically submit nodes using the usual form API pattern.

Code

function node_type_set_defaults($info = array()) {
  $info = (array) $info;
  $new_type = $info + array(
    'type' => '',
    'name' => '',
    'base' => '',
    'description' => '',
    'help' => '',
    'custom' => 0,
    'modified' => 0,
    'locked' => 1,
    'disabled' => 0,
    'is_new' => 1,
    'has_title' => 1,
    'title_label' => 'Title',
  );
  $new_type = (object) $new_type;

  // If the type has no title, set an empty label.
  if (!$new_type->has_title) {
    $new_type->title_label = '';
  }
  if (empty($new_type->module)) {
    $new_type->module = $new_type->base == 'node_content' ? 'node' : '';
  }
  $new_type->orig_type = isset($info['type']) ? $info['type'] : '';

  return $new_type;
}
Error | ELMSLN API

Error

×

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/api.elmsln.org/includes/common.inc:2791) in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/api.elmsln.org/sites/all/modules/apc/drupal_apc_cache.inc).
The website encountered an unexpected error. Please try again later.