X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fviews%2Fsrc%2FPlugin%2Fviews%2Farea%2FTextCustom.php;fp=web%2Fcore%2Fmodules%2Fviews%2Fsrc%2FPlugin%2Fviews%2Farea%2FTextCustom.php;h=56e963dd6f457a2d77c712ac93e4c0e4d91dcb0d;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hp=0000000000000000000000000000000000000000;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad;p=yaffs-website diff --git a/web/core/modules/views/src/Plugin/views/area/TextCustom.php b/web/core/modules/views/src/Plugin/views/area/TextCustom.php new file mode 100644 index 000000000..56e963dd6 --- /dev/null +++ b/web/core/modules/views/src/Plugin/views/area/TextCustom.php @@ -0,0 +1,61 @@ + '']; + return $options; + } + + /** + * {@inheritdoc} + */ + public function buildOptionsForm(&$form, FormStateInterface $form_state) { + parent::buildOptionsForm($form, $form_state); + + $form['content'] = [ + '#title' => $this->t('Content'), + '#type' => 'textarea', + '#default_value' => $this->options['content'], + '#rows' => 6, + ]; + } + + /** + * {@inheritdoc} + */ + public function render($empty = FALSE) { + if (!$empty || !empty($this->options['empty'])) { + return [ + '#markup' => $this->renderTextarea($this->options['content']), + ]; + } + + return []; + } + + /** + * Render a text area with \Drupal\Component\Utility\Xss::filterAdmin(). + */ + public function renderTextarea($value) { + if ($value) { + return $this->sanitizeValue($this->tokenizeValue($value), 'xss_admin'); + } + } + +}