Problem/Motivation

Currently all the logic inside views_handler_area_view() is written inside a single method, which makes it really hard to reuse any of the code in a subclass.

Proposed resolution

Split up the loading from the rendering, so that subclasses can deal with it easily.

Remaining tasks

User interface changes

API changes

Beta phase evaluation

Reference: https://www.drupal.org/core/beta-changes
Issue category Task, because its not a feature or bug
Issue priority Normal, makes life easier for some people and improves the code for itself

Comments

dawehner’s picture

Status: Active » Needs review
StatusFileSize
new2.65 KB

Here is a basic patch.

dawehner’s picture

The patch was manually tested.

dawehner’s picture

The patch was manually tested.

jibran’s picture

Status: Needs review » Reviewed & tested by the community

Just minor issue other then that it's RTBC.

+++ b/handlers/views_handler_area_view.inc
@@ -51,33 +51,49 @@ class views_handler_area_view extends views_handler_area {
+      return;
...
+      return;
...
+      return;

Can we return NULL here?

das-peter’s picture

Function wise this looks much prettier now :) and it worked on my env.
Just found some coding standard nit-picks, but most of them are copy-pasted from the old code, so I'd say RTBC.

  1. +++ b/handlers/views_handler_area_view.inc
    @@ -51,33 +51,49 @@ class views_handler_area_view extends views_handler_area {
    +      return;
    ...
    +      return;
    

    Not sure if there's a coding standard but I think explicitly returning NULL would be nicer.

  2. +++ b/handlers/views_handler_area_view.inc
    @@ -51,33 +51,49 @@ class views_handler_area_view extends views_handler_area {
    +    // Avoid recursion
    ...
    +    // Check if the view is part of the parent views of this view
    

    Inline comments must end in full-stops, exclamation marks, or question marks

  3. +++ b/handlers/views_handler_area_view.inc
    @@ -51,33 +51,49 @@ class views_handler_area_view extends views_handler_area {
    +
    +
    

    The closing brace for the class must have an empty line before it.

dawehner’s picture

Project: Views (for Drupal 7) » Drupal core
Version: 7.x-3.x-dev » 9.x-dev
Component: Code » ajax system
Status: Reviewed & tested by the community » Patch (to be ported)

Thank you for the quick reviews!

Committed and pushed to 7.x-3.x

dawehner’s picture

Version: 9.x-dev » 8.0.x-dev
Component: ajax system » views.module

.

kim.pepper’s picture

Assigned: Unassigned » kim.pepper

Taking a look.

kim.pepper’s picture

Assigned: kim.pepper » Unassigned
Status: Patch (to be ported) » Needs review
StatusFileSize
new3.15 KB

OK. Here's a patch.

dawehner’s picture

+++ b/core/modules/views/src/Plugin/views/area/View.php
@@ -167,4 +147,39 @@ public function calculateDependencies() {
+      drupal_set_message(t("Recursion detected in view @view display @display.", array('@view' => $view_name, '@display' => $display_id)), 'error');

Should be $this->t() I think

kim.pepper’s picture

StatusFileSize
new3.16 KB
new806 bytes

Fix for #10

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

Cool, thank you!

jibran’s picture

Issue tags: +Needs beta evaluation

Needs beta evaluation criteria.

dawehner’s picture

Issue summary: View changes

What about adding one for youself :P

Added one.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work

Currently all the logic inside views_handler_area_view() is written inside a single method, which makes it really hard to reuse any of the code in a subclass.

Yep - but how often does contrib need to do this? Can the beta evaluation be updated to include a bit more info?

dawehner’s picture

Well, I don't know how often contrib would have to do that (maybe oncein total ;)), but I just had a requirement on a client side and patched views for that.
It made things more readable as well at the same time.

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.2.x-dev

Drupal 8 is end-of-life as of November 17, 2021. There will not be further changes made to Drupal 8. Bugfixes are now made to the 9.3.x and higher branches only. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.15 was released on June 1st, 2022 and is the final full bugfix release for the Drupal 9.3.x series. Drupal 9.3.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.4.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.9 was released on December 7, 2022 and is the final full bugfix release for the Drupal 9.4.x series. Drupal 9.4.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.5.x-dev branch from now on, and new development or disruptive changes should be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

smustgrave’s picture

Status: Needs work » Postponed (maintainer needs more info)
Issue tags: +stale-issue-cleanup

Thank you for creating this issue to improve Drupal.

We are working to decide if this task is still relevant to a currently supported version of Drupal. There hasn't been any discussion here for over 8 years which suggests that this has either been implemented or is no longer relevant. Your thoughts on this will allow a decision to be made.

Since we need more information to move forward with this issue, the status is now Postponed (maintainer needs more info). If we don't receive additional information to help with the issue, it may be closed after three months.

Thanks!

smustgrave’s picture

Wanted to bump 1 more time but views_handler_area_view doesn't appear in the repo anymore.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.