Skip to content
Snippets Groups Projects
Commit 196b21f4 authored by Project Update Bot's avatar Project Update Bot Committed by Kostia Bohach
Browse files

Issue #3147374 by Project Update Bot: Automated Drupal 9 compatibility fixes

parent f5c8c924
No related branches found
No related tags found
2 merge requests!2Revert "by John Morahan: jquery_update is no longer required",!1Set up GitLab CI
......@@ -40,7 +40,7 @@ function entityreference_live_preview_field_widget_form_alter(&$element, FormSta
// TODO: currently only supports the target preview type
$target_type = $context['items']->getFieldDefinition()->getFieldStorageDefinition()->getSettings()['target_type'];
$view_builder = \Drupal::entityManager()->getViewBuilder($target_type);
$view_builder = \Drupal::service('entity_type.manager')->getViewBuilder($target_type);
if ($form_state->getValues()) {
$context['widget']->extractFormValues($context['items'], $form_state->getCompleteForm(), $form_state);
......@@ -144,7 +144,7 @@ function entityreference_live_preview_field_widget_third_party_settings_form(Wid
// To preview the target entity, we use its own display modes.
$entity_type = $field_definition->getSetting('target_type');
}
$options = \Drupal::entityManager()->getViewModeOptions($entity_type);
$options = \Drupal::service('entity_display.repository')->getViewModeOptions($entity_type);
$element['enabled'] = array(
'#type' => 'checkbox',
......@@ -212,7 +212,7 @@ function _entityreference_live_preview_render_entity($widget, $target) {
switch ($instance_info['widget']['settings']['entityreference_live_preview']['preview_type']) {
case 'target':
$entities = entity_load($target_type, array($target_id));
$entities = \Drupal::service('entity_type.manager')->getStorage($target_type)->load(array($target_id));
foreach ($entities as $entity) {
if (!entity_access('view', $target_type, $entity)) {
return '';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment