1 node.api.php hook_node_type_load(&$types)

Respond to the loading of node types.

This hook is called after loading node types from configuration files. It can be used to populate default values within a node type's settings. Note that after loading, if the node type is later saved, these defaults are saved into configuration.

Parameters

$types: An array of type information, passed by reference. Each item is keyed by the node type name, and is an array of values as loaded from the node type config file. The most common use is to populate the "settings" array with defaults. For a complete list of keys for a node type, see _node_types_build().

See also

_node_types_build()

Related topics

File

core/modules/node/node.api.php, line 902
Hooks provided by the Node module.

Code

function hook_node_type_load(&$types) {
  foreach ($types as $type_name => $type) {
    $types[$type_name]->settings += array(
      'status_default' => NODE_PUBLISHED,
      'promote_default' => FALSE,
      'sticky_default' => FALSE,
      'revision_default' => FALSE,
      'show_submitted_info' => TRUE,
    );
  }
}