You are here

function i18ncontent_node_add in Internationalization 6

Replacement for node_add

This just calls node_add() and switches title. This has to be done here to work always

1 string reference to 'i18ncontent_node_add'
i18ncontent_menu_alter in i18ncontent/i18ncontent.module
Implementation of hook_menu_alter().

File

i18ncontent/i18ncontent.module, line 201
Internationalization (i18n) package - translatable content type parameters

Code

function i18ncontent_node_add($type) {
  global $user;
  $types = node_get_types();
  $type = isset($type) ? str_replace('-', '_', $type) : NULL;

  // If a node type has been specified, validate its existence.
  if (isset($types[$type]) && node_access('create', $type)) {

    // Initialize settings:
    $node = array(
      'uid' => $user->uid,
      'name' => isset($user->name) ? $user->name : '',
      'type' => $type,
      'language' => '',
    );
    drupal_set_title(t('Create @name', array(
      '@name' => i18nstrings("nodetype:type:{$type}:name", $types[$type]->name),
    )));
    $output = drupal_get_form($type . '_node_form', $node);
  }
  return $output;
}