class Text
Same name and namespace in other branches
- 11.x core/modules/views/src/Plugin/views/area/Text.php \Drupal\views\Plugin\views\area\Text
Views area text handler.
Plugin annotation
@ViewsArea("text");
Hierarchy
- class \Drupal\Component\Plugin\PluginBase extends \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 implements \Drupal\Component\Plugin\PluginBase
- class \Drupal\views\Plugin\views\PluginBase extends \Drupal\Core\Plugin\ContainerFactoryPluginInterface, \Drupal\views\Plugin\views\ViewsPluginInterface, \Drupal\Component\Plugin\DependentPluginInterface, \Drupal\Core\Security\TrustedCallbackInterface implements \Drupal\Core\Plugin\PluginBase
- class \Drupal\views\Plugin\views\HandlerBase extends \Drupal\views\Plugin\views\ViewsHandlerInterface implements \Drupal\views\Plugin\views\PluginBase
- class \Drupal\views\Plugin\views\area\AreaPluginBase implements \Drupal\views\Plugin\views\HandlerBase
- class \Drupal\views\Plugin\views\area\TokenizeAreaPluginBase implements \Drupal\views\Plugin\views\area\AreaPluginBase
- class \Drupal\views\Plugin\views\area\Text implements \Drupal\views\Plugin\views\area\TokenizeAreaPluginBase
- class \Drupal\views\Plugin\views\area\TokenizeAreaPluginBase implements \Drupal\views\Plugin\views\area\AreaPluginBase
- class \Drupal\views\Plugin\views\area\AreaPluginBase implements \Drupal\views\Plugin\views\HandlerBase
- class \Drupal\views\Plugin\views\HandlerBase extends \Drupal\views\Plugin\views\ViewsHandlerInterface implements \Drupal\views\Plugin\views\PluginBase
- class \Drupal\views\Plugin\views\PluginBase extends \Drupal\Core\Plugin\ContainerFactoryPluginInterface, \Drupal\views\Plugin\views\ViewsPluginInterface, \Drupal\Component\Plugin\DependentPluginInterface, \Drupal\Core\Security\TrustedCallbackInterface implements \Drupal\Core\Plugin\PluginBase
- class \Drupal\Core\Plugin\PluginBase uses \Drupal\Core\StringTranslation\StringTranslationTrait, \Drupal\Core\DependencyInjection\DependencySerializationTrait, \Drupal\Core\Messenger\MessengerTrait implements \Drupal\Component\Plugin\PluginBase
Expanded class hierarchy of Text
Related topics
320 string references to 'Text'
- block_content.schema.yml in core/
modules/ block_content/ config/ schema/ block_content.schema.yml - core/modules/block_content/config/schema/block_content.schema.yml
- ckeditor.schema.yml in core/
modules/ ckeditor/ config/ schema/ ckeditor.schema.yml - core/modules/ckeditor/config/schema/ckeditor.schema.yml
- claro_preprocess_input in core/
themes/ claro/ claro.theme - Implements template_preprocess_HOOK() for input.
- comment.schema.yml in core/
modules/ comment/ config/ schema/ comment.schema.yml - core/modules/comment/config/schema/comment.schema.yml
- CommentEntityTranslationTest::providerSource in core/
modules/ comment/ tests/ src/ Kernel/ Plugin/ migrate/ source/ d7/ CommentEntityTranslationTest.php
File
-
core/
modules/ views/ src/ Plugin/ views/ area/ Text.php, line 14
Namespace
Drupal\views\Plugin\views\areaView source
class Text extends TokenizeAreaPluginBase {
/**
* {@inheritdoc}
*/
protected function defineOptions() {
$options = parent::defineOptions();
$options['content'] = [
'contains' => [
'value' => [
'default' => '',
],
'format' => [
'default' => NULL,
],
],
];
return $options;
}
/**
* {@inheritdoc}
*/
public function buildOptionsForm(&$form, FormStateInterface $form_state) {
parent::buildOptionsForm($form, $form_state);
$form['content'] = [
'#title' => $this->t('Content'),
'#type' => 'text_format',
'#default_value' => $this->options['content']['value'],
'#rows' => 6,
'#format' => $this->options['content']['format'] ?? filter_default_format(),
'#editor' => FALSE,
];
}
/**
* {@inheritdoc}
*/
public function preQuery() {
$content = $this->options['content']['value'];
// Check for tokens that require a total row count.
if (strpos($content, '[view:page-count]') !== FALSE || strpos($content, '[view:total-rows]') !== FALSE) {
$this->view->get_total_rows = TRUE;
}
}
/**
* {@inheritdoc}
*/
public function render($empty = FALSE) {
$format = $this->options['content']['format'] ?? filter_default_format();
if (!$empty || !empty($this->options['empty'])) {
return [
'#type' => 'processed_text',
'#text' => $this->tokenizeValue($this->options['content']['value']),
'#format' => $format,
];
}
return [];
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.