FieldEmbedView::getFieldBuild() contains the following code.
$view = Views::getView($display_field['settings']['embed_view']);
$view->setDisplay($display_settings['settings']['view_display'] ?? 'default');
$view->setAjaxEnabled($display_settings['settings']['enable_ajax'] ?? 'default');
// Set the view URL to the current page for the exposed filter form
// redirection.
$view->override_url = Url::fromRoute('<current>');
// Build the view arguments.
$args = [];
if (!empty($display_settings['settings']['arguments'])) {
$view_object = \Drupal::service('entity_type.manager')->getStorage('view')->load($display_field['settings']['embed_view']);
// Omissis
}
The code is loading the same view twice, first via Views::getView() and then via \Drupal::service('entity_type.manager')->getStorage('view')->load() which would return the same value, since Views::getView() contains the following code.
$view = \Drupal::entityTypeManager()
->getStorage('view')
->load($id);
if ($view) {
return static::executableFactory()
->get($view);
}
return NULL;
Comments
Comment #2
avpadernoComment #4
avpadernoComment #5
vensiresComment #7
avpaderno