i try to include a node creation form by a field attach form. So i try to load the entity of a custom content type created by the back-office with is called ‘friterie’. But when i call the entity_create function i get this error : Call to undefined function entity_create()
Here is my code :
function fritr_register_friterie_form($form, &$form_state) { $form = array(); // INCLUDE FRITERIE ADD FORM $form['friterie'] = array(); //module_load_include('inc', 'node', 'node.pages'); this is an old method //$form['friterie'] = node_add('friterie'); global $language; $entity = entity_create('node', array('type' => 'friterie', 'language' => $language->language)); //$form['friterie'] = field_attach_form('node', $entity, $form['friterie'], $form_state); // INCLUDE USER REGISTER FORM //$form['user'] = drupal_get_form('user_register_form'); $form['submit'] = array( '#type' => 'submit', '#value' => t('Enregistrer la friterie'), ); dsm($form); return $form; }
I don’t know why i get this error, i watch on the official documentation and it says i can do it like i did :/