GIF89a; %PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY
Server IP : 134.29.175.74 / Your IP : 216.73.216.160 Web Server : nginx/1.10.2 System : Windows NT CST-WEBSERVER 10.0 build 19045 (Windows 10) i586 User : Administrator ( 0) PHP Version : 7.1.0 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /nginx/html/Student/JimMartinson/Lab12/drupal/core/modules/views/src/Plugin/views/field/ |
Upload File : |
<?php namespace Drupal\views\Plugin\views\field; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Url as CoreUrl; use Drupal\views\ResultRow; /** * Field handler to provide simple renderer that turns a URL into a clickable link. * * @ingroup views_field_handlers * * @ViewsField("url") */ class Url extends FieldPluginBase { /** * {@inheritdoc} */ protected function defineOptions() { $options = parent::defineOptions(); $options['display_as_link'] = ['default' => 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'); } } }