At the moment we have a few different init methods; One in HandlerBase, and Plugins (not handlers). There is no init() method in the PluginBase class for these to extend, so each one (like AreaPluginBase, CachePluginBase) are just using the same one. We can probably move this into the base class and remove all of these, just overriding where we need to.

So we could try making all plugins follow the handler type constructor, i.e:

public function init(ViewExecutable $view, &$display, $options = NULL) {}

At the moment this doesn't really work with argument_default and validator plugins as they currently pass in the argument plugin here.

Here is an initial patch. Maybe we could change $display in the signature for $plugin or something instead?

I am fully expecting this to fail in its current state.

Comments

damiankloip’s picture

StatusFileSize
new45.42 KB

@dawehner suggested we could have a setArgument() method on argument_* plugins, so maybe something like this?

damiankloip’s picture

Status: Active » Needs review

Status: Needs review » Needs work

The last submitted patch, 1850792-1.patch, failed testing.

dawehner’s picture

Assigned: Unassigned » dawehner

Working on it.

dawehner’s picture

Assigned: dawehner » Unassigned
Status: Needs work » Needs review
StatusFileSize
new69.84 KB

It seems to be that, as the display plugin is a special kind of plugin, we should use and extra method for displays.

Status: Needs review » Needs work

The last submitted patch, drupal-1850792-4.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review
StatusFileSize
new38.46 KB
new68.47 KB

Finally fixed the errors

Status: Needs review » Needs work

The last submitted patch, drupal-1850792-7.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review
StatusFileSize
new2.83 KB
new71.29 KB

Let's see.

Status: Needs review » Needs work

The last submitted patch, drupal-1850792-9.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review
StatusFileSize
new71.25 KB

Forgot to pull recently.

Status: Needs review » Needs work

The last submitted patch, drupal-1850792-11.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review
StatusFileSize
new73 KB

There we are ...

Status: Needs review » Needs work

The last submitted patch, drupal-1850792-13.patch, failed testing.

tim.plunkett’s picture

Assigned: Unassigned » damiankloip
Status: Needs work » Needs review
StatusFileSize
new760 bytes
new73.37 KB

I love when there is a real reason for a bug!

The options for argument validators are hidden with #states, and there is a FAPI hack in there to force them to be added to the $form_state regardless. However, that hack doesn't respect Views option defaults, so we have to explicitly specify the default value.

Assuming this passes, I think it's RTBC, but assigning to @damiankloip for a final sign-off.

dawehner’s picture

If we do that, shouldn't we do the same for argument default plugins in ArgumentPluginBase::default_argument_form()?

tim.plunkett’s picture

StatusFileSize
new74.1 KB

Yes we should.

damiankloip’s picture

Status: Needs review » Reviewed & tested by the community

Looking good to me now. This is a nice clean up!

damiankloip’s picture

StatusFileSize
new0 bytes

Rerolled to current HEAD.

Can we get this one is soon if possible? It touches lots of files, as well as other patches needing to use this new format.

damiankloip’s picture

StatusFileSize
new74.13 KB

Oops, sorry, a patch with some bytes is good.

damiankloip’s picture

Issue tags: -VDC

#20: vdc-1850792-20.patch queued for re-testing.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, vdc-1850792-20.patch, failed testing.

damiankloip’s picture

Status: Needs work » Needs review

#20: vdc-1850792-20.patch queued for re-testing.

dawehner’s picture

#20: vdc-1850792-20.patch queued for re-testing.

Status: Needs review » Needs work
Issue tags: +VDC

The last submitted patch, vdc-1850792-20.patch, failed testing.

damiankloip’s picture

Status: Needs work » Needs review
StatusFileSize
new74.43 KB

Re rolled, I think it was the display array patch?

Status: Needs review » Needs work

The last submitted patch, vdc-1850792-26.patch, failed testing.

damiankloip’s picture

Yeah ok, that broke slightly.

tim.plunkett’s picture

DisplayArray::initializeDisplay() is still calling DisplayPluginBase::init(), I think it now needs to call DisplayPluginBase::initDisplay()

damiankloip’s picture

Status: Needs work » Needs review
StatusFileSize
new75.21 KB

Yeah, nice catch! I think that is right on. Displays don't have an init() method anymore.

tim.plunkett’s picture

Status: Needs review » Reviewed & tested by the community

Cool, glad that was an easy fix.

This is a huge plus for DX. Let's get it in!

webchick’s picture

Status: Reviewed & tested by the community » Fixed

This looks like sensible clean-up.

Committed and pushed to 8.x. Thanks!

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

Anonymous’s picture

Issue summary: View changes

Updated issue summary.

mradcliffe’s picture