function contact_field_extra_fields

Implements hook_field_extra_fields().

File

drupal/core/modules/contact/contact.module, line 178
Enables the use of personal and site-wide contact forms.

Code

function contact_field_extra_fields() {
  $fields = array();
  foreach (array_keys(entity_get_bundles('contact_message')) as $bundle) {
    $fields['contact_message'][$bundle]['form']['name'] = array(
      'label' => t('Sender name'),
      'description' => t('Text'),
      'weight' => -50,
    );
    $fields['contact_message'][$bundle]['form']['mail'] = array(
      'label' => t('Sender e-mail'),
      'description' => t('E-mail'),
      'weight' => -40,
    );

    // @todo Recipient only makes sense if user contact form is a bundle/category.
    $fields['contact_message'][$bundle]['form']['recipient'] = array(
      'label' => t('Recipient user name'),
      'description' => t('User'),
      'weight' => -30,
    );
    $fields['contact_message'][$bundle]['form']['subject'] = array(
      'label' => t('Subject'),
      'description' => t('Text'),
      'weight' => -10,
    );
    $fields['contact_message'][$bundle]['form']['message'] = array(
      'label' => t('Message'),
      'description' => t('Long text'),
      'weight' => 0,
    );
    $fields['contact_message'][$bundle]['form']['copy'] = array(
      'label' => t('Send copy to sender'),
      'description' => t('Option'),
      'weight' => 50,
    );
    $fields['contact_message'][$bundle]['display']['message'] = array(
      'label' => t('Message'),
      'description' => t('The main contact message'),
      'weight' => 0,
    );
  }
  $fields['user']['user']['form']['contact'] = array(
    'label' => t('Contact settings'),
    'description' => t('Contact module form element.'),
    'weight' => 5,
  );
  return $fields;
}