class TextCustom
Same name and namespace in other branches
- 11.x core/modules/views/src/Plugin/views/area/TextCustom.php \Drupal\views\Plugin\views\area\TextCustom
- 10 core/modules/views/src/Plugin/views/area/TextCustom.php \Drupal\views\Plugin\views\area\TextCustom
- 8.9.x core/modules/views/src/Plugin/views/area/TextCustom.php \Drupal\views\Plugin\views\area\TextCustom
Views area text handler.
Plugin annotation
@ViewsArea("text_custom");
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements \Drupal\Component\Plugin\PluginInspectionInterface, \Drupal\Component\Plugin\DerivativeInspectionInterface
- class \Drupal\Core\Plugin\PluginBase uses \Drupal\Core\StringTranslation\StringTranslationTrait, \Drupal\Core\DependencyInjection\DependencySerializationTrait, \Drupal\Core\Messenger\MessengerTrait extends \Drupal\Component\Plugin\PluginBase
- class \Drupal\views\Plugin\views\PluginBase implements \Drupal\Core\Plugin\ContainerFactoryPluginInterface, \Drupal\views\Plugin\views\ViewsPluginInterface, \Drupal\Component\Plugin\DependentPluginInterface, \Drupal\Core\Security\TrustedCallbackInterface extends \Drupal\Core\Plugin\PluginBase
- class \Drupal\views\Plugin\views\HandlerBase implements \Drupal\views\Plugin\views\ViewsHandlerInterface extends \Drupal\views\Plugin\views\PluginBase
- class \Drupal\views\Plugin\views\area\AreaPluginBase extends \Drupal\views\Plugin\views\HandlerBase
- class \Drupal\views\Plugin\views\area\TokenizeAreaPluginBase extends \Drupal\views\Plugin\views\area\AreaPluginBase
- class \Drupal\views\Plugin\views\area\TextCustom extends \Drupal\views\Plugin\views\area\TokenizeAreaPluginBase
- class \Drupal\views\Plugin\views\area\TokenizeAreaPluginBase extends \Drupal\views\Plugin\views\area\AreaPluginBase
- class \Drupal\views\Plugin\views\area\AreaPluginBase extends \Drupal\views\Plugin\views\HandlerBase
- class \Drupal\views\Plugin\views\HandlerBase implements \Drupal\views\Plugin\views\ViewsHandlerInterface extends \Drupal\views\Plugin\views\PluginBase
- class \Drupal\views\Plugin\views\PluginBase implements \Drupal\Core\Plugin\ContainerFactoryPluginInterface, \Drupal\views\Plugin\views\ViewsPluginInterface, \Drupal\Component\Plugin\DependentPluginInterface, \Drupal\Core\Security\TrustedCallbackInterface extends \Drupal\Core\Plugin\PluginBase
- class \Drupal\Core\Plugin\PluginBase uses \Drupal\Core\StringTranslation\StringTranslationTrait, \Drupal\Core\DependencyInjection\DependencySerializationTrait, \Drupal\Core\Messenger\MessengerTrait extends \Drupal\Component\Plugin\PluginBase
Expanded class hierarchy of TextCustom
Related topics
File
-
core/
modules/ views/ src/ Plugin/ views/ area/ TextCustom.php, line 15
Namespace
Drupal\views\Plugin\views\areaView source
class TextCustom extends TokenizeAreaPluginBase {
/**
* {@inheritdoc}
*/
protected function defineOptions() {
$options = parent::defineOptions();
$options['content'] = [
'default' => '',
];
return $options;
}
/**
* {@inheritdoc}
*/
public function buildOptionsForm(&$form, FormStateInterface $form_state) {
parent::buildOptionsForm($form, $form_state);
$form['content'] = [
'#title' => $this->t('Content'),
'#type' => 'textarea',
'#description' => $this->t('You may enter data from this view as per the "Available global token replacements" above. You may include the following allowed HTML tags: <code>@tags</code>', [
'@tags' => '<' . implode('> <', Xss::getAdminTagList()) . '>',
]),
'#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');
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.