jasonglisson
1/17/2015 - 8:07 PM

Drupal 7 - Create content type programatically

Drupal 7 - Create content type programatically

//CREATE NEW CONTENT TYPE
function orderform_node_info() {
  return array(
    'event' => array(
    'name' => t('Event'),
    'base' => 'event',
    'description' => t('A event content type'),
    'has_title' => TRUE
    ),
  );
}


function event_form($node,$form_state) {
  $form['title'] = array(
    '#type' => 'textfield',
    '#title' => t('event Title'),
    '#default_value' => !empty($node->title) ? $node->title : '',
    '#required' => TRUE,
    '#weight' => -5
  );
  return $form;
}
//END CONTENT TYPE