trait UncacheableFieldHandlerTrait in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/views/src/Plugin/views/field/UncacheableFieldHandlerTrait.php \Drupal\views\Plugin\views\field\UncacheableFieldHandlerTrait
Trait encapsulating the logic for uncacheable field handlers.
Hierarchy
- trait \Drupal\views\Plugin\views\field\UncacheableFieldHandlerTrait
1 file declares its use of UncacheableFieldHandlerTrait
- BulkForm.php in core/
modules/ system/ src/ Plugin/ views/ field/ BulkForm.php - Contains \Drupal\system\Plugin\views\field\BulkForm.
File
- core/
modules/ views/ src/ Plugin/ views/ field/ UncacheableFieldHandlerTrait.php, line 15 - Contains \Drupal\views\Plugin\views\field\UncacheableFieldHandlerTrait.
Namespace
Drupal\views\Plugin\views\fieldView source
trait UncacheableFieldHandlerTrait {
/**
* {@inheritdoc}
*
* @see \Drupal\views\Plugin\views\Field\FieldHandlerInterface::render()
*/
public function render(ResultRow $row) {
return $this
->getFieldTokenPlaceholder();
}
/**
* {@inheritdoc}
*
* @see \Drupal\views\Plugin\views\Field\FieldHandlerInterface::postRender()
*/
public function postRender(ResultRow $row, $output) {
$placeholder = $this
->getFieldTokenPlaceholder();
$value = $this
->doRender($row);
$this->last_render = str_replace($placeholder, $value, $output);
return [
$placeholder => $value,
];
}
/**
* {@inheritdoc}
*
* @see \Drupal\views\Plugin\views\Field\FieldPluginBase::getFieldTokenPlaceholder()
*/
protected abstract function getFieldTokenPlaceholder();
/**
* Actually renders the field markup.
*
* @param \Drupal\views\ResultRow $row
* A result row.
*
* @return string
* The field markup.
*/
protected function doRender(ResultRow $row) {
return $this
->getValue($row);
}
/**
* {@inheritdoc}
*
* @see \Drupal\views\Plugin\views\Field\FieldHandlerInterface::getValue()
*/
protected abstract function getValue(ResultRow $row, $field = NULL);
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
UncacheableFieldHandlerTrait:: |
protected | function | Actually renders the field markup. | |
UncacheableFieldHandlerTrait:: |
abstract protected | function | ||
UncacheableFieldHandlerTrait:: |
abstract protected | function | 2 | |
UncacheableFieldHandlerTrait:: |
public | function | ||
UncacheableFieldHandlerTrait:: |
public | function |