protected function SimpleMathField::getRelationshipEntity in Views Simple Math Field 8
Same name and namespace in other branches
- 8.2 src/Plugin/views/field/SimpleMathField.php \Drupal\views_simple_math_field\Plugin\views\field\SimpleMathField::getRelationshipEntity()
Parameters
$values:
$field:
$relationship:
Return value
\Drupal\Core\Entity\EntityInterface|null
Throws
\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
\Drupal\Component\Plugin\Exception\PluginNotFoundException
1 call to SimpleMathField::getRelationshipEntity()
- SimpleMathField::getFieldValue in src/
Plugin/ views/ field/ SimpleMathField.php - Get the value of a simple math field.
File
- src/
Plugin/ views/ field/ SimpleMathField.php, line 231 - Defines Drupal\views_simple_math_field\Plugin\views\field\SimpleMathField.
Class
- SimpleMathField
- Field handler to complete mathematical operation.
Namespace
Drupal\views_simple_math_field\Plugin\views\fieldCode
protected function getRelationshipEntity($values, $field, $relationship) {
$relationship_entity = NULL;
// Get the entity type of the relationship.
$relationship_entity_type = $this->displayHandler
->getHandler('field', $field)
->getEntityType();
$relationship_entities = $values->_relationship_entities;
// First check the referenced entity.
if (isset($relationship_entities[$relationship])) {
// Get the id of the relationship entity.
$entity_id = $relationship_entities[$relationship]
->id();
// Get the data of the relationship entity.
$relationship_entity = $this->entityTypeManager
->getStorage($relationship_entity_type)
->load($entity_id);
}
return $relationship_entity;
}