public function EntityReference::getEntityIdFromFieldItem in Reference Table Formatter 8
The the entity ID from the field value.
Parameters
\Drupal\Core\Field\FieldItemInterface $item: The reference field to gain the ID for.
Return value
int An entity ID.
Overrides FormatterInterface::getEntityIdFromFieldItem
File
- src/
Plugin/ Field/ FieldFormatter/ EntityReference.php, line 26
Class
- EntityReference
- A field formatter to display a table.
Namespace
Drupal\reference_table_formatter\Plugin\Field\FieldFormatterCode
public function getEntityIdFromFieldItem(FieldItemInterface $item) {
return $item
->getValue()['target_id'];
}