You are here

function simplenews_node_type in Simplenews 6.2

Same name and namespace in other branches
  1. 6 simplenews.module \simplenews_node_type()

Implementation of hook_node_type().

Update 'simplenews_content_types' on node update and delete. Related vocabulary settings are updated by taxonomy module.

File

./simplenews.module, line 581
Simplenews node handling, sent email, newsletter block and general hooks

Code

function simplenews_node_type($op, $info) {
  switch ($op) {
    case 'delete':
      $simplenews_types = variable_get('simplenews_content_types', array(
        'simplenews',
      ));
      if (isset($simplenews_types[$info->type])) {
        unset($simplenews_types[$info->type]);
        variable_set('simplenews_content_types', $simplenews_types);
      }
      break;
    case 'update':
      $simplenews_types = variable_get('simplenews_content_types', array(
        'simplenews',
      ));

      // apply nodetype rename
      if (isset($info->old_type) && isset($simplenews_types[$info->old_type]) && $info->old_type != $info->type) {
        unset($simplenews_types[$info->old_type]);
        $simplenews_types[$info->type] = $info->type;
        variable_set('simplenews_content_types', $simplenews_types);
      }
      break;
  }
}