additional_fields['nid'] = 'nid'; } /** * {@inheritdoc} */ protected function defineOptions() { $options = parent::defineOptions(); $options['absolute'] = ['default' => FALSE]; return $options; } /** * {@inheritdoc} */ public function buildOptionsForm(&$form, FormStateInterface $form_state) { parent::buildOptionsForm($form, $form_state); $form['absolute'] = [ '#type' => 'checkbox', '#title' => $this->t('Use absolute link (begins with "http://")'), '#default_value' => $this->options['absolute'], '#description' => $this->t('Enable this option to output an absolute link. Required if you want to use the path as a link destination (as in "output this field as a link" above).'), '#fieldset' => 'alter', ]; } /** * {@inheritdoc} */ public function query() { $this->ensureMyTable(); $this->addAdditionalFields(); } /** * {@inheritdoc} */ public function render(ResultRow $values) { $nid = $this->getValue($values, 'nid'); return [ '#markup' => \Drupal::url('entity.node.canonical', ['node' => $nid], ['absolute' => $this->options['absolute']]), ]; } }