+ 'replace_button' => [
+ '#type' => 'submit',
+ '#value' => $this->t('Replace'),
+ '#ajax' => [
+ 'callback' => [get_class($this), 'updateWidgetCallback'],
+ 'wrapper' => $details_id,
+ ],
+ '#submit' => [[get_class($this), 'removeItemSubmit']],
+ '#name' => $field_machine_name . '_replace_' . $entity_id . '_' . md5(json_encode($field_parents)),
+ '#limit_validation_errors' => [array_merge($field_parents, [$field_machine_name, 'target_id'])],
+ '#attributes' => [
+ 'data-entity-id' => $entity->getEntityTypeId() . ':' . $entity->id(),
+ 'data-row-id' => $delta,
+ 'class' => ['replace-button'],
+ ],
+ '#access' => $replace_button_access,
+ ],