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

CommentFileSizeAuthor
#3 3150490-3.patch851 bytesjungle
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jungle created an issue. See original summary.

jungle’s picture

Issue summary: View changes
jungle’s picture

Status: Active » Needs review
FileSize
851 bytes
pratik_kamble’s picture

Assigned: Unassigned » pratik_kamble
pratik_kamble’s picture

Assigned: pratik_kamble » Unassigned
Status: Needs review » Reviewed & tested by the community

@jungle thanks for the patch. I have applied the patch in comment #3. It applies cleanly. Verified code change, LGMT.

pratik_kamble’s picture

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 3: 3150490-3.patch, failed testing. View results

jungle’s picture

Status: Needs work » Reviewed & tested by the community

Re-queued. A random failure.

  • catch committed fe749ea on 9.1.x
    Issue #3150490 by jungle, pratik_kamble: Make the variable naming less...
catch’s picture

Status: Reviewed & tested by the community » Fixed
Issue tags: -Needs subsystem maintainer review

Committed fe749ea and pushed to 9.1.x. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.