GetText.php in Message 8
File
src/Plugin/views/field/GetText.php
View source
<?php
namespace Drupal\message\Plugin\views\field;
use Drupal\Component\Render\FormattableMarkup;
use Drupal\Core\Form\FormStateInterface;
use Drupal\views\Plugin\views\field\FieldPluginBase;
use Drupal\views\ResultRow;
class GetText extends FieldPluginBase {
protected $build;
public function query() {
}
public function render(ResultRow $values) {
$delta = is_numeric($this->options['delta']) ? $this->options['delta'] : NULL;
return new FormattableMarkup(implode("\n", $values->_entity
->getText(NULL, $delta)), []);
}
protected function defineOptions() {
$options = parent::defineOptions();
$options['delta'] = [
'default' => '',
];
return $options;
}
public function buildOptionsForm(&$form, FormStateInterface $form_state) {
$form['delta'] = [
'#type' => 'textfield',
'#title' => $this
->t('Delta'),
'#size' => 5,
'#default_value' => $this->options['delta'],
];
parent::buildOptionsForm($form, $form_state);
}
}
Classes
Name |
Description |
GetText |
Field handler to present a link to the node. |