TRUE]; return $options; } /** * Provide link to the page being visited. */ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['display_as_link'] = [ '#title' => $this->t('Display as link'), '#type' => 'checkbox', '#default_value' => !empty($this->options['display_as_link']), ]; parent::buildOptionsForm($form, $form_state); } /** * {@inheritdoc} */ public function render(ResultRow $values) { $value = $this->getValue($values); if (!empty($this->options['display_as_link'])) { // @todo Views should expect and store a leading /. See: // https://www.drupal.org/node/2423913 return \Drupal::l($this->sanitizeValue($value), CoreUrl::fromUserInput('/' . $value)); } else { return $this->sanitizeValue($value, 'url'); } } }