t('Link label'); $form['text']['#required'] = TRUE; $form['text']['#default_value'] = empty($this->options['text']) ? $this->getDefaultLabel() : $this->options['text']; } /** * {@inheritdoc} */ protected function getUrlInfo(ResultRow $row) { return Url::fromRoute('entity.user.contact_form', ['user' => $this->getEntity($row)->id()]); } /** * {@inheritdoc} */ protected function renderLink(ResultRow $row) { $entity = $this->getEntity($row); $this->options['alter']['make_link'] = TRUE; $this->options['alter']['url'] = $this->getUrlInfo($row); $title = $this->t('Contact %user', ['%user' => $entity->label()]); $this->options['alter']['attributes'] = ['title' => $title]; if (!empty($this->options['text'])) { return $this->options['text']; } else { return $title; } } /** * {@inheritdoc} */ protected function getDefaultLabel() { return $this->t('contact'); } }