You are here

function _simplenews_install_nodetype in Simplenews 7.2

Same name and namespace in other branches
  1. 6.2 simplenews.install \_simplenews_install_nodetype()
  2. 6 simplenews.install \_simplenews_install_nodetype()
  3. 7 simplenews.install \_simplenews_install_nodetype()

Create simplenews node type.

1 call to _simplenews_install_nodetype()
simplenews_install in ./simplenews.install
Implements hook_install().

File

./simplenews.install, line 344
Install, update and uninstall functions for the simplenews module

Code

function _simplenews_install_nodetype() {

  // Create a newsletter type if needed.
  $type = node_type_get_type('simplenews');
  if (!$type) {
    $type = node_type_set_defaults(array(
      'type' => 'simplenews',
      'name' => t('Newsletter issue'),
      'base' => 'node_content',
      'description' => t('A newsletter issue to be sent to subscribed email addresses.'),
      'locked' => 0,
      'custom' => 1,
      'modified' => 1,
    ));
    node_type_save($type);
    node_add_body_field($type);
  }
  simplenews_issue_fields_add($type);
  variable_set('simplenews_content_type_' . $type->type, TRUE);
}