- Issue created by @apaderno
- Status changed to Needs review
3 months ago 10:05am 19 March 2024
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;
Needs review
9.1
Code