Obtaining the node type being added with php Other than pulling the information from the url itself, is there a way to retrieve/obtain the node type that has been selected in the add content area. ie: www.mydomain.com/node/add/article... using PHP? I have been able to do this when updating/editing a node using menu_get_object() in a template file but not when adding a node.
If you are changing the form used to create a node, then you could use the following code. 

function mymodule_form_node_form_alter(&amp;$form, &amp;$form_state) {
  $node = $form_state['node'];
  if (!isset($node-&gt;nid) || isset($node-&gt;is_new)) {
    // The node is being created.
    // Use $node-&gt;type to get the content type of the node.
  }
}


The reason is that node_add(), the page callback for the node creation form, contains the following code.

  $types = node_type_get_types();
  $node = (object) array(
    'uid' =&gt; $user-&gt;uid,
    'name' =&gt; (isset($user-&gt;name) ? $user-&gt;name : ''),
    'type' =&gt; $type,
    'language' =&gt; LANGUAGE_NONE,
  );
  drupal_set_title(t('Create @name', array('@name' =&gt; $types[$type]-&gt;name)), PASS_THROUGH);
  $output = drupal_get_form($type . '_node_form', $node);


This means that the form used when creating a node is the node edit form.

As alternative, if you need to change the node creating form when the content type is, for example, article, you can use the following code.

function mymodule_form_article_node_form_alter(&amp;$form, &amp;$form_state) {
  $node = $form_state['node'];
  if (!isset($node-&gt;nid) || isset($node-&gt;is_new)) {
    // The node is being created.
  }
}


As in this case the form is altered only when article is the content type of the node, you don't actually need to check the content type.

If you need that information in other cases, then you can only get it from the URL.