public function RedHenContactInlineEntityFormController::entityFormSubmit in RedHen CRM 7
Overrides EntityInlineEntityFormController::entityFormSubmit().
Overrides EntityInlineEntityFormController::entityFormSubmit
File
- modules/
redhen_contact/ lib/ redhen_contact.inline_entity_form.inc, line 71 - Defines the inline entity form controller for RedHen contacts.
Class
- RedHenContactInlineEntityFormController
- Class RedHenContactInlineEntityFormController.
Code
public function entityFormSubmit(&$entity_form, &$form_state) {
parent::entityFormSubmit($entity_form, $form_state);
$contact =& $entity_form['#entity'];
// Save default parameters back into the $contact object.
$contact->first_name = $contact->name['first_name'];
$contact->last_name = $contact->name['last_name'];
// Set the contact's author uid.
global $user;
$contact->author_uid = $user->uid;
// Get form_state array, only including the subform of this entity.
$child_form_state = form_state_defaults();
$child_form_state['values'] = drupal_array_get_nested_value($form_state['values'], $entity_form['#parents']);
// Save the contact.
$contact = redhen_contact_save($contact);
}