protected function JsonapiHelper::relationshipHandleable in Entity Share 8
Same name and namespace in other branches
- 8.2 modules/entity_share_client/src/Service/JsonapiHelper.php \Drupal\entity_share_client\Service\JsonapiHelper::relationshipHandleable()
Check if a relationship is handleable.
Filter on fields not targeting config entities or users.
Parameters
\Drupal\Core\Field\FieldItemListInterface $field: The field item list.
Return value
bool TRUE if the relationship is handleable.
1 call to JsonapiHelper::relationshipHandleable()
- JsonapiHelper::updateRelationships in modules/
entity_share_client/ src/ Service/ JsonapiHelper.php - Create or update the entity reference field values of an entity.
File
- modules/
entity_share_client/ src/ Service/ JsonapiHelper.php, line 535
Class
- JsonapiHelper
- Class JsonapiHelper.
Namespace
Drupal\entity_share_client\ServiceCode
protected function relationshipHandleable(FieldItemListInterface $field) {
$relationship_handleable = FALSE;
if ($field instanceof EntityReferenceFieldItemListInterface) {
$settings = $field
->getItemDefinition()
->getSettings();
// TODO: Other field types that inherit from entity reference should be
// handled automatically or using a plugin/event system if possible.
// Entity reference and Entity reference revisions.
if (isset($settings['target_type'])) {
$relationship_handleable = !$this
->isUserOrConfigEntity($settings['target_type']);
}
elseif (isset($settings['entity_type_ids'])) {
foreach ($settings['entity_type_ids'] as $entity_type_id) {
$relationship_handleable = !$this
->isUserOrConfigEntity($entity_type_id);
if (!$relationship_handleable) {
break;
}
}
}
}
return $relationship_handleable;
}