class Text in Drupal 10
Same name and namespace in other branches
- 8 core/modules/views/src/Plugin/views/area/Text.php \Drupal\views\Plugin\views\area\Text
- 9 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\views\Plugin\views\area\AreaPluginBase extends \Drupal\views\Plugin\views\HandlerBase
- class \Drupal\views\Plugin\views\area\TokenizeAreaPluginBase
- class \Drupal\views\Plugin\views\area\Text
- class \Drupal\views\Plugin\views\area\TokenizeAreaPluginBase
Expanded class hierarchy of Text
Related topics
20 string references to 'Text'
- contact_entity_extra_field_info in core/
modules/ contact/ contact.module - Implements hook_entity_extra_field_info().
- core.data_types.schema.yml in core/
config/ schema/ core.data_types.schema.yml - core/config/schema/core.data_types.schema.yml
- drupal6.php in core/
modules/ migrate_drupal/ tests/ fixtures/ drupal6.php - A database agnostic dump for testing purposes.
- FormTestClickedButtonForm::buildForm in core/
modules/ system/ tests/ modules/ form_test/ src/ Form/ FormTestClickedButtonForm.php - Form constructor.
- hook_system_breadcrumb_alter in core/
lib/ Drupal/ Core/ Menu/ menu.api.php - Perform alterations to the breadcrumb built by the BreadcrumbManager.
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 [];
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
AreaPluginBase:: |
public | property | The type of this area handler, i.e. 'header', 'footer', or 'empty'. | |
AreaPluginBase:: |
public | function | ||
AreaPluginBase:: |
public | function | Overrides Drupal\views\Plugin\views\HandlerBase::init(). | 1 |
AreaPluginBase:: |
public | function | Does that area have nothing to show. | 1 |
AreaPluginBase:: |
public | function | Performs any operations needed before full rendering. | 1 |
AreaPluginBase:: |
public | function | ||
Text:: |
public | function |
Overrides TokenizeAreaPluginBase:: |
|
Text:: |
protected | function |
Overrides TokenizeAreaPluginBase:: |
|
Text:: |
public | function | ||
Text:: |
public | function |
Render the area. Overrides AreaPluginBase:: |
|
TokenizeAreaPluginBase:: |
public | function | Adds tokenization form elements. | |
TokenizeAreaPluginBase:: |
public | function | Replaces value with special views tokens and global tokens. |