You are here

public function ShurlyShortUrl::buildOptionsForm in ShURLy 8

Default options form that provides the label widget that all fields should have.

Overrides FieldPluginBase::buildOptionsForm

File

src/Plugin/views/field/ShurlyShortUrl.php, line 39

Class

ShurlyShortUrl
Field handler to present a link to the short URL entry.

Namespace

Drupal\shurly\Plugin\views\field

Code

public function buildOptionsForm(&$form, FormStateInterface $form_state) {
  unset($form['empty']);
  unset($form['hide_empty']);
  unset($form['hide_empty']);
  $form['text'] = [
    '#type' => 'textfield',
    '#title' => t('Text to display'),
    '#default_value' => $this->options['text'],
  ];
  $form['longshort'] = [
    '#type' => 'radios',
    '#options' => [
      0 => t('Output full URL including base path'),
      1 => t('Output only the short path'),
    ],
    '#default_value' => $this->options['longshort'],
  ];
  $form['link'] = [
    '#type' => 'checkbox',
    '#title' => t('Output as link'),
    '#default_value' => $this->options['link'],
    '#description' => t('Wrap output with a link to the short URL. Use <em>Output this field as a link</em> above for more complex options.'),
  ];
  parent::buildOptionsForm($form, $form_state);
}