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\Component\Utility\Xss; use Drupal\Core\Form\FormStateInterface; use Drupal\views\Render\ViewsRenderPipelineMarkup; use Drupal\views\ResultRow; /** * A handler to provide a field that is completely custom by the administrator. * * @ingroup views_field_handlers * * @ViewsField("custom") */ class Custom extends FieldPluginBase { /** * {@inheritdoc} */ public function usesGroupBy() { return FALSE; } /** * {@inheritdoc} */ public function query() { // do nothing -- to override the parent query. } /** * {@inheritdoc} */ protected function defineOptions() { $options = parent::defineOptions(); // Override the alter text option to always alter the text. $options['alter']['contains']['alter_text'] = ['default' => TRUE]; $options['hide_alter_empty'] = ['default' => FALSE]; return $options; } /** * {@inheritdoc} */ public function buildOptionsForm(&$form, FormStateInterface $form_state) { parent::buildOptionsForm($form, $form_state); // Remove the checkbox unset($form['alter']['alter_text']); unset($form['alter']['text']['#states']); unset($form['alter']['help']['#states']); $form['#pre_render'][] = [$this, 'preRenderCustomForm']; } /** * {@inheritdoc} */ public function render(ResultRow $values) { // Return the text, so the code never thinks the value is empty. return ViewsRenderPipelineMarkup::create(Xss::filterAdmin($this->options['alter']['text'])); } /** * Prerender function to move the textarea to the top of a form. * * @param array $form * The form build array. * * @return array * The modified form build array. */ public function preRenderCustomForm($form) { $form['text'] = $form['alter']['text']; $form['help'] = $form['alter']['help']; unset($form['alter']['text']); unset($form['alter']['help']); return $form; } }