function FieldPluginBase::getValue

Same name and namespace in other branches
  1. 9 core/modules/views/src/Plugin/views/field/FieldPluginBase.php \Drupal\views\Plugin\views\field\FieldPluginBase::getValue()
  2. 8.9.x core/modules/views/src/Plugin/views/field/FieldPluginBase.php \Drupal\views\Plugin\views\field\FieldPluginBase::getValue()
  3. 11.x core/modules/views/src/Plugin/views/field/FieldPluginBase.php \Drupal\views\Plugin\views\field\FieldPluginBase::getValue()

Gets the value that's supposed to be rendered.

This api exists so that other modules can easy set the values of the field without having the need to change the render method as well.

Parameters

\Drupal\views\ResultRow $values: An object containing all retrieved values.

string|null $field: (optional) Index of the row element. If NULL the last row is used. Defaults to NULL.

Return value

mixed The value to be rendered.

Overrides FieldHandlerInterface::getValue

26 calls to FieldPluginBase::getValue()
Boolean::render in core/modules/views/src/Plugin/views/field/Boolean.php
Renders the field.
Date::render in core/modules/views/src/Plugin/views/field/Date.php
Renders the field.
DblogMessage::render in core/modules/dblog/src/Plugin/views/field/DblogMessage.php
Renders the field.
DblogMessage::render in core/modules/dblog/src/Plugin/views/field/DblogMessage.php
Renders the field.
DblogOperations::render in core/modules/dblog/src/Plugin/views/field/DblogOperations.php
Renders the field.

... See full list

2 methods override FieldPluginBase::getValue()
EntityField::getValue in core/modules/views/src/Plugin/views/field/EntityField.php
Gets the value that's supposed to be rendered.
MediaLibrarySelectForm::getValue in core/modules/media_library/src/Plugin/views/field/MediaLibrarySelectForm.php
Gets the value that's supposed to be rendered.

File

core/modules/views/src/Plugin/views/field/FieldPluginBase.php, line 463

Class

FieldPluginBase
Base class for views fields.

Namespace

Drupal\views\Plugin\views\field

Code

public function getValue(ResultRow $values, $field = NULL) {
    $alias = isset($field) ? $this->aliases[$field] : $this->field_alias;
    if (isset($values->{$alias})) {
        return $values->{$alias};
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.