public function SearchApiBulkForm::getEntity in Search API 8
Gets the entity matching the current row and relationship.
Parameters
\Drupal\views\ResultRow $values: An object containing all retrieved values.
Return value
\Drupal\Core\Entity\EntityInterface Returns the entity matching the values.
Overrides SearchApiFieldTrait::getEntity
See also
\Drupal\views\Plugin\views\field\FieldHandlerInterface::getEntity()
1 call to SearchApiBulkForm::getEntity()
- SearchApiBulkForm::viewsForm in src/
Plugin/ views/ field/ SearchApiBulkForm.php - Form constructor for the bulk form.
File
- src/
Plugin/ views/ field/ SearchApiBulkForm.php, line 80
Class
- SearchApiBulkForm
- Defines an actions-based bulk operation form element.
Namespace
Drupal\search_api\Plugin\views\fieldCode
public function getEntity(ResultRow $values) {
/** @var \Drupal\search_api\Plugin\views\ResultRow $values */
try {
$value = $values->_item
->getOriginalObject()
->getValue();
} catch (SearchApiException $e) {
return NULL;
}
return $value instanceof EntityInterface ? $value : NULL;
}