At the moment $view->storage->display contains of ViewDisplay objects even this object is for storage only.
In general as the storage is not handled by viewDisplay anymore you could get rid of these objects,
let $storage->display only contains the pure config options
and use an array of display handlers on the viewExecutable.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dawehner’s picture

Assigned: Unassigned » dawehner

I will work on that.

tim.plunkett’s picture

Assigned: dawehner » tim.plunkett

I started a sandbox branch for this: http://drupalcode.org/sandbox/damiankloip/1685040.git/shortlog/refs/head...
One thing that can be done is making sure the code actually NEEDS the whole display object.

An example is http://drupalcode.org/sandbox/damiankloip/1685040.git/commitdiff/e8d9504

tim.plunkett’s picture

Assigned: tim.plunkett » dawehner

lol

dawehner’s picture

Assigned: dawehner » Unassigned

Added tests and refactored one function:

a5f411b get the paths without instanciating the displays
33dd513 add tests for getDisplayList, getPath and addDisplay

The main issue with doing that at the moment is that for example the wizard is using
the active handlers to save values and the handler itself has logic we need in methods like
getItems (for example override).

We should probably store a reference to $storage->display['id'] which is an array of the options
directly in the display handler.

tim.plunkett’s picture

Priority: Normal » Major

The difference between ViewExecutable::display and ViewStorage::display is maddening.
We need different property names for each.
And this is blocking the removal of __set/__get code.

dawehner’s picture

Some ideas:

  • ViewExecutable::displayInstances + ViewStorage::display
  • ViewExecutable:displayHandlers
  • ViewExecutable:display ViewStorage:displayOptions

My favourite is option two at the moment, maybe you have another preference?

tim.plunkett’s picture

displayHandlers is good. Also, are we worried about $this->display AND $this->displays in this issue?

dawehner’s picture

At the moment views most often uses singular for multiple instance of objects (like the database tables), for example view->filter, view->field
so i think if we do it, we should do it later but for all of them.

dawehner’s picture

Status: Active » Needs review
FileSize
19.97 KB

50c918a write tests for ViewStorage::add/set/getItem(s) and fix one issue in ViewStorage
145e6e7 first introduction of displayHandlers and some tests for the methods

Let's first introduce $executable->displayHandlers and then remove the ViewDisplay objects.
At the moment i just wrote test and converted the tested methods to the new array.

dawehner’s picture

FileSize
117.04 KB

9a13d78 let the plugins just store the display handler instance instead of the viewDisplay and adapt all the function calls
697a258 convert a lot of usages of display handlers to the new array

Status: Needs review » Needs work

The last submitted patch, views-1788238-10.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review
FileSize
117.04 KB

So let's retest it.

Status: Needs review » Needs work

The last submitted patch, views-1788238-12.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review
FileSize
117.06 KB

One less php fatal

Status: Needs review » Needs work

The last submitted patch, views-1788238-14.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review
FileSize
116.98 KB

Let's see whether this is better

Status: Needs review » Needs work

The last submitted patch, views-1788238-16.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review
FileSize
120.05 KB

-        $output .= theme(views_theme_functions('views_view_grouping', $this->view, $this->view->display),
+       $output .= theme(views_theme_functions('views_view_grouping', $this->view, $this->view->display[$this->view->current_display]),

I totally think that could be made better, what about storing a reference to the display options in the display plugins?
From the runned local tests this could be green aka. good to go on an work on ViewDisplay.

Status: Needs review » Needs work

The last submitted patch, views-1788238-18.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review
FileSize
199.29 KB

Started to remove the viewDisplay object and replace every place which uses it, this change
is currently not committed but i would like the bot to run on that.

Status: Needs review » Needs work

The last submitted patch, views-1788238-20.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review
FileSize
199.79 KB

Some more fixes, tsss still not 200kb

dawehner’s picture

FileSize
199.81 KB

Even more fixes.

Status: Needs review » Needs work

The last submitted patch, views-1788238-23.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review
FileSize
203.67 KB

This could be it, yes 200kb!

Status: Needs review » Needs work

The last submitted patch, views-1788238-25.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review
FileSize
204.19 KB

At least the amount of fails/exceptions and passes were sort of symmetric.

tim.plunkett’s picture

Assigned: Unassigned » tim.plunkett

I REALLY want to commit this now, but I should do a full review tonight.
Hopefully it'll be in before you wake up @dawehner :)

dawehner’s picture

+++ b/lib/Drupal/views/Plugin/views/PluginBase.phpundefined
@@ -27,6 +27,15 @@ abstract class PluginBase extends ComponentPluginBase {
+   * The display object this plugin is for.
+   *

This doesn't sound good!

+++ b/lib/Drupal/views/Plugin/views/PluginBase.phpundefined
@@ -164,7 +174,7 @@ abstract class PluginBase extends ComponentPluginBase {
+    return views_theme_functions($this->definition['theme'], $this->view, $this->view->display[$this->view->current_display]);

@@ -174,7 +184,7 @@ abstract class PluginBase extends ComponentPluginBase {
+        $funcs[] = views_theme_functions($theme, $this->view, $this->view->display[$this->view->current_display]);

This could be $this->view->display_handler instead.

For the rest i'm to tired now

tim.plunkett’s picture

Assigned: tim.plunkett » dawehner
Status: Needs review » Reviewed & tested by the community

Hm, I can't come up with a better comment right now, but let's find one.

I think the $this->view->current_display stuff could be a follow-up.

This is reallllly great stuff.

dawehner’s picture

Status: Reviewed & tested by the community » Fixed

Not bad: 75 files changed, 836 insertions(+), 772 deletions(-)
This patch is one reason to use git commit -a :)

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