function phonefield_field_instance_settings_form in Phone Field 7
Implements hook_field_instance_settings_form().
File
- ./
phonefield.module, line 117 - Hooks for a module that defines a simple phone number field type.
Code
function phonefield_field_instance_settings_form($field, $instance) {
$form = array(
'#element_validate' => array(
'phonefield_field_settings_form_validate',
),
);
$title_options = array(
'static' => t('Static label'),
'optional' => t('Optional label'),
'none' => t('No label'),
);
$form['linkstate'] = array(
'#type' => 'radios',
'#title' => t('Phone link label'),
'#default_value' => isset($instance['settings']['linkstate']) ? $instance['settings']['linkstate'] : 'static',
'#options' => $title_options,
'#description' => t('If the phone link label is optional, there will be a translatable field for the label. If the label is static, the phone link will always use the same label.'),
);
$form['linkvalue'] = array(
'#type' => 'textfield',
'#title' => t('Static or default phone link label'),
'#default_value' => !empty($instance['settings']['linkvalue']) ? $instance['settings']['linkvalue'] : t('Phone'),
'#description' => t('This label will be used if “Static label” is selected above, or if “Optional label” is selected above <em>and</em> no link label is entered when creating content.'),
'#states' => array(
'visible' => array(
array(
':input[name="instance[settings][linkstate]"]' => array(
'value' => 'optional',
),
),
array(
':input[name="instance[settings][linkstate]"]' => array(
'value' => 'static',
),
),
),
),
);
return $form;
}