protected function ContentEntityConflictHandler::autoMergeNonEditableFields in Conflict 8.2
Merges non-editable fields.
As non-editable fields are considered fields that are not contained in the form display or the current user does not have edit access for them.
Parameters
\Drupal\Core\Entity\ContentEntityInterface $entity_local_edited: The locally edited entity.
\Drupal\Core\Entity\ContentEntityInterface $entity_server: The unchanged entity loaded from the storage.
\Drupal\Core\Entity\Display\EntityFormDisplayInterface $form_display: The form display that the entity form operates with.
1 call to ContentEntityConflictHandler::autoMergeNonEditableFields()
- ContentEntityConflictHandler::entityFormEntityBuilder in src/
Entity/ ContentEntityConflictHandler.php - Entity builder method.
File
- src/
Entity/ ContentEntityConflictHandler.php, line 439
Class
Namespace
Drupal\conflict\EntityCode
protected function autoMergeNonEditableFields(ContentEntityInterface $entity_local_edited, ContentEntityInterface $entity_server, EntityFormDisplayInterface $form_display) {
$components = $form_display
->getComponents();
foreach ($entity_local_edited
->getFields() as $field_name => $items) {
if (!isset($components[$field_name]) || !$items
->access('edit')) {
$items
->setValue($entity_server
->get($field_name)
->getValue(TRUE));
}
}
}