You are here

public function LinkImageField::instanceSettingsForm in Link Image Field 8

File

lib/Drupal/linkimagefield/Plugin/Field/FieldType/LinkImageField.php, line 126

Class

LinkImageField
Plugin implementation of the 'LinkImageField' field type.

Namespace

Drupal\linkimagefield\Plugin\Field\FieldType

Code

public function instanceSettingsForm(array $form, array &$form_state) {
  $element = parent::instanceSettingsForm($form, $form_state);
  $settings = $this
    ->getSettings();
  $element['url_settings'] = array(
    '#type' => 'details',
    '#title' => t('URL Link settings'),
    '#open' => TRUE,
    '#weight' => 0,
  );
  $element['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_settings']['url'],
    '#maxlength' => '255',
  );
  $element['url_settings']['rel_field'] = array(
    '#type' => 'checkbox',
    '#title' => t('Enable link <em>rel</em> field'),
    '#default_value' => $settings['url_settings']['rel_field'],
    '#description' => t('Allow rel attributes to be added to links'),
  );
  $element['url_settings']['class_field'] = array(
    '#type' => 'checkbox',
    '#title' => t('Enable link <em>class</em> field'),
    '#default_value' => $settings['url_settings']['class_field'],
    '#description' => t('Allow classes to be added to links'),
  );
  $target_options = _linkimagefield_widget_url_target_options();
  $element['url_settings']['custom_target'] = array(
    '#type' => 'checkbox',
    '#title' => t('Enable custom target'),
    '#default_value' => $settings['url_settings']['custom_target'],
    '#description' => t('Enable user to provide alternate target frame for link.'),
  );
  $element['url_settings']['target'] = array(
    '#type' => 'select',
    '#title' => t('Default Target'),
    '#description' => t('Select a default target type.'),
    '#default_value' => $settings['url_settings']['target'],
    '#options' => $target_options,
    '#maxlength' => '255',
  );
  $element['longdesc_field'] = array(
    '#type' => 'checkbox',
    '#title' => t('Enable <em>Longdesc</em> field'),
    '#default_value' => $settings['longdesc_field'],
    '#description' => t('Allow the longdesc attribute to be added to images'),
    '#weight' => 10,
  );
  return $element;
}