protected function FieldableEdgeEntityBase::getFieldValue in Apigee Edge 8
Returns the field value from the current object.
Parameters
string $field_name: Machine name of a field.
Return value
mixed|null Value of a field from current object, or null if it does exits.
1 call to FieldableEdgeEntityBase::getFieldValue()
- FieldableEdgeEntityBase::get in src/
Entity/ FieldableEdgeEntityBase.php - Gets a field item list.
File
- src/
Entity/ FieldableEdgeEntityBase.php, line 287
Class
- FieldableEdgeEntityBase
- Base field support for Apigee Entities without making them content entities.
Namespace
Drupal\apigee_edge\EntityCode
protected function getFieldValue(string $field_name) {
// We call the getters on the current object instead of the decorated one
// because they can return the correct information.
// Because the current object implements the interface of the decorated
// object there should be any getter on the decorated object that does not
// have a decorator in the current class (that potentially also calls to the
// decorated getter method under the hood.)
foreach ([
'get',
'is',
] as $prefix) {
$getter = $prefix . ucfirst($field_name);
if (method_exists($this, $getter)) {
return call_user_func([
$this,
$getter,
]);
}
}
return NULL;
}