function _redhen_contact_user_embed_contact_form in RedHen CRM 7
Same name and namespace in other branches
- 8 modules/redhen_contact/redhen_contact.module \_redhen_contact_user_embed_contact_form()
Helper function to embed a contact form on a user form.
Usage note: make sure to add a submit handler, otherwise this form data will just be ignored.
Parameters
array $form: Form array.
array $form_state: Form state array.
RedhenContact $contact: The contact to build the form on.
2 calls to _redhen_contact_user_embed_contact_form()
- redhen_contact_form_user_profile_form_alter in modules/
redhen_contact/ redhen_contact.module - Implements hook_form_FORM_ID_alter().
- redhen_contact_form_user_register_form_alter in modules/
redhen_contact/ redhen_contact.module - Implements hook_form_FORM_ID_alter().
File
- modules/
redhen_contact/ redhen_contact.module, line 1235 - Module file for RedHen contacts.
Code
function _redhen_contact_user_embed_contact_form(&$form, &$form_state, RedhenContact $contact) {
module_load_include('inc', 'redhen_contact', 'includes/redhen_contact.forms');
// Get contact type form.
$form['redhen_contact'] = array(
'#type' => 'fieldset',
'#title' => t('Contact information'),
'form' => redhen_contact_contact_form(array(), $form_state, $contact),
);
// Unset the contact forms action, we will use the parent form's actions.
unset($form['redhen_contact']['form']['actions']);
}