Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
/**
* Instantiates a ViewExecutable class.
*
* @param \Drupal\views\ViewEntityInterface $view
* A view entity instance.
*
* @return \Drupal\views\ViewExecutable
* A ViewExecutable instance.
*/
public function get(ViewEntityInterface $view) {
$view = new ViewExecutable($view, $this->user, $this->viewsData, $this->routeProvider);
$view->setRequest($this->requestStack->getCurrentRequest());
return $view;
}
The $view
parameter passed in is an instance of ViewEntityInterface
, at the first line of the method body, it becomes an instance of ViewExecutable
immediately, which is confusing. And not sure if it is a bug with type-hinting.
Proposed resolution
/**
* Instantiates a ViewExecutable class.
*
* @param \Drupal\views\ViewEntityInterface $view
* A view entity instance.
*
* @return \Drupal\views\ViewExecutable
* A ViewExecutable instance.
*/
public function get(ViewEntityInterface $view) {
$view_executable = new ViewExecutable($view, $this->user, $this->viewsData, $this->routeProvider);
$view_executable->setRequest($this->requestStack->getCurrentRequest());
return $view_executable;
}
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
Comment | File | Size | Author |
---|---|---|---|
#3 | 3150490-3.patch | 851 bytes | jungle |
Comments
Comment #2
jungleComment #3
jungleComment #4
pratik_kambleComment #5
pratik_kamble@jungle thanks for the patch. I have applied the patch in comment #3. It applies cleanly. Verified code change, LGMT.
Comment #6
pratik_kambleComment #8
jungleRe-queued. A random failure.
Comment #10
catchCommitted fe749ea and pushed to 9.1.x. Thanks!