function email_contact_field_formatter_settings_form in Email Contact 7
Implements hook_field_formatter_settings_form().
File
- ./
email_contact.module, line 72 - File name: email_contact.module.
Code
function email_contact_field_formatter_settings_form($field, $instance, $view_mode, $form, &$form_state) {
$display = $instance['display'][$view_mode];
$settings = $display['settings'];
$element['redirection_to'] = array(
'#title' => t('Redirection after form submit'),
'#type' => 'radios',
'#options' => array(
'front' => t('To the frontpage'),
'current' => t('To the current page'),
'custom' => t('To a custom path'),
),
'#default_value' => $settings['redirection_to'],
'#required' => TRUE,
);
$element['custom_path'] = array(
'#title' => t('Redirection path'),
'#type' => 'textfield',
'#states' => array(
'visible' => array(
'input[name="redirection_to"]' => array(
'value' => 'custom',
),
),
),
'#default_value' => $settings['custom_path'],
'#element_validate' => array(
'_email_contact_field_formatter_settings_form_validate',
),
);
if ($display['type'] == 'email_contact_link') {
$element['link_text'] = array(
'#title' => t('Text for the contact link'),
'#type' => 'textfield',
'#suffix' => t('Leaving it empty will cause the default value to appear as a translatable string.'),
'#default_value' => $settings['link_text'],
);
}
$element['default_message'] = array(
'#title' => t('Additional message in email body'),
'#type' => 'textfield',
'#default_value' => $settings['default_message'],
);
if (module_exists('token')) {
$element['token_help'] = array(
'#theme' => 'token_tree',
'#token_types' => array(
'node',
),
);
}
return $element;
}