1 nodeapi_example.install nodeapi_example_install()

Implements hook_install().

We need to set a default nodeapi_example_node_type_<contentType> setting of 0 for each available node type.

We call node_type_get_types() to get a list of all node types.

Related topics

File

modules/examples/nodeapi_example/nodeapi_example.install, line 58
Install, update and uninstall functions for the nodeapi_example module.

Code

function nodeapi_example_install() {
  $config = config('nodeapi_example.settings');
  $node_types = array_keys(node_type_get_types());
  foreach ($node_types as $type) {
    $config->set('nodeapi_example_node_type_' . $type, 0);
  }
  $config->save();
}