function linkimagefield_field_instance_settings_form in Link Image Field 7
Implements hook_field_instance_settings_form().
File
- ./
linkimagefield.module, line 51 - Defines a link image field type.
Code
function linkimagefield_field_instance_settings_form($field, $instance) {
// Use the image field instance settings form as a basis.
$form = image_field_instance_settings_form($field, $instance);
$settings = isset($instance['settings']['url_settings']) ? $instance['settings']['url_settings'] : $instance['settings'];
$form['url_settings'] = array(
'#type' => 'fieldset',
'#title' => t('URL Link settings'),
'#collapsible' => TRUE,
'#collapsed' => FALSE,
'#weight' => 0,
);
$form['url_settings']['url'] = array(
'#type' => 'textfield',
'#title' => t('Default URL'),
'#description' => t('Provide a well-formed URL. This will be the default url linked to by provided images.'),
'#default_value' => $settings['url'],
'#maxlength' => '255',
);
$form['url_settings']['rel_field'] = array(
'#type' => 'checkbox',
'#title' => t('Enable link <em>rel</em> field'),
'#default_value' => $settings['rel_field'],
'#description' => t('Allow rel attributes to be added to links'),
);
$form['url_settings']['class_field'] = array(
'#type' => 'checkbox',
'#title' => t('Enable link <em>class</em> field'),
'#default_value' => $settings['class_field'],
'#description' => t('Allow classes to be added to links'),
);
$target_options = _linkimagefield_widget_url_target_options();
$form['url_settings']['custom_target'] = array(
'#type' => 'checkbox',
'#title' => t('Enable custom target'),
'#default_value' => $settings['custom_target'],
'#description' => t('Enable user to provide alternate target frame for link.'),
);
$form['url_settings']['target'] = array(
'#type' => 'select',
'#title' => t('Default Target'),
'#description' => t('Select a default target type.'),
'#default_value' => !empty($settings['target']) ? $settings['target'] : '_self',
'#options' => $target_options,
'#maxlength' => '255',
);
$form['longdesc_field'] = array(
'#type' => 'checkbox',
'#title' => t('Enable <em>Longdesc</em> field'),
'#default_value' => $instance['settings']['longdesc_field'],
'#description' => t('Allow the longdesc attribute to be added to images'),
'#weight' => 10,
);
return $form;
}