function textformatter_contrib_textformatter_field_formatter_settings_form_alter in Text list formatter 8.2
Same name and namespace in other branches
- 7 textformatter_contrib/textformatter_contrib.module \textformatter_contrib_textformatter_field_formatter_settings_form_alter()
Implements hook_textformatter_field_formatter_settings_form_alter().
File
- textformatter_contrib/
textformatter_contrib.module, line 181 - Textformatter support for contributed module fields.
Code
function textformatter_contrib_textformatter_field_formatter_settings_form_alter(&$form, &$form_state, $context) {
$field = $context['field'];
$view_mode = $context['view_mode'];
$settings = $context['instance']['display'][$view_mode]['settings'];
if ($field['type'] == 'entityreference') {
$form['textformatter_contrib']['entityreference_link'] = array(
'#type' => 'checkbox',
'#title' => t("Link list items to their @entity entity.", array(
'@entity' => $field['settings']['target_type'],
)),
'#description' => t("Generate item list with links to the node page"),
'#default_value' => isset($settings['textformatter_contrib']['entityreference_link']) ? $settings['textformatter_contrib']['entityreference_link'] : TRUE,
);
}
if ($field['type'] == 'node_reference') {
$form['textformatter_contrib']['node_reference_link'] = array(
'#type' => 'checkbox',
'#title' => t("Link list items to their node."),
'#description' => t("Generate item list with links to the node page"),
'#default_value' => isset($settings['textformatter_contrib']['node_reference_link']) ? $settings['textformatter_contrib']['node_reference_link'] : TRUE,
);
}
if ($field['type'] == 'user_reference') {
$form['textformatter_contrib']['user_reference_link'] = array(
'#type' => 'checkbox',
'#title' => t("Link list items to their user page."),
'#description' => t("Generate item list with links to the user page"),
'#default_value' => isset($settings['textformatter_contrib']['user_reference_link']) ? $settings['textformatter_contrib']['user_reference_link'] : TRUE,
);
}
if ($field['type'] == 'link_field') {
$link_info = is_callable('link_field_formatter_info') ? link_field_formatter_info() : array();
$form['textformatter_contrib']['link_field_display_type'] = array(
'#type' => 'select',
'#title' => t('Link field formatting type'),
'#description' => t('Select the type of link field to show in the list.'),
'#options' => drupal_map_assoc(array_keys($link_info)),
'#default_value' => isset($settings['textformatter_contrib']['link_field_display_type']) ? $settings['textformatter_contrib']['link_field_display_type'] : 'link_default',
);
}
}