You are here

function date_tools_wizard_create_content_type in Date 6.2

Same name and namespace in other branches
  1. 8 date_tools/date_tools.wizard.inc \date_tools_wizard_create_content_type()
  2. 7.3 date_tools/date_tools.wizard.inc \date_tools_wizard_create_content_type()
  3. 7 date_tools/date_tools.wizard.inc \date_tools_wizard_create_content_type()
  4. 7.2 date_tools/date_tools.wizard.inc \date_tools_wizard_create_content_type()
1 call to date_tools_wizard_create_content_type()
date_tools_wizard_build in date_tools/date_tools.wizard.inc

File

date_tools/date_tools.wizard.inc, line 313
Date Wizard code.

Code

function date_tools_wizard_create_content_type($name, $type_name, $description, $type_settings = array()) {
  date_tools_wizard_include();

  // Create the content type.
  $values = array(
    'name' => $name,
    'type' => $type_name,
    'description' => $description,
    'title_label' => 'Title',
    'body_label' => 'Body',
    'min_word_count' => '0',
    'help' => '',
    'node_options' => array(
      'status' => 1,
      'promote' => 1,
      'sticky' => 0,
      'revision' => 0,
    ),
    'language_content_type' => '0',
    'old_type' => $type_name,
    'orig_type' => '',
    'module' => 'node',
    'custom' => '1',
    'modified' => '1',
    'locked' => '0',
    'url_str' => str_replace('_', '-', $type_name),
  );

  // Allow overrides of these values.
  foreach ($type_settings as $key => $value) {
    $values[$key] = $value;
  }
  $type = (object) _node_type_set_defaults($values);
  node_type_save($type);
  if ($type == 'ical_feed') {

    // Default type to not be promoted and have comments disabled.
    variable_set('node_options_' . $type_name, array(
      'status',
    ));
    variable_set('comment_' . $type_name, COMMENT_NODE_DISABLED);

    // Don't display date and author information for this type by default.
    $theme_settings = variable_get('theme_settings', array());
    $theme_settings['toggle_node_info_' . $type_name] = FALSE;
    variable_set('theme_settings', $theme_settings);
  }

  // Update the menu router information.
  menu_rebuild();
  content_clear_type_cache();
}