There are currently four patterns used by init() methods:
QueryPluginBase.php: public function init($base_table, $base_field, $options) {
HandlerBase (and children): public function init(&$view, &$options) {
PluginBase (and children): public function init(&$view, &$display, $options = NULL) {
public function init(&$view, &$display, $options = array()) {
public function init(&$view, &$display) {
(LocalizationPluginBase) public function init(&$view) {
(argument plugins) public function init(&$view, &$argument, $options) {
The last 3 or 4 could all be easily unified, just pick a standard default argument for $options.
I'm not 100% sure about the argument plugin ones.
QueryPluginBase::init() should probably be renamed outright.
In addition, we need to clean up calls to $this->setOptionDefaults($this->options, $this->defineOptions());
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | interdiff.txt | 816 bytes | dawehner |
| #8 | drupal-1778356-8.patch | 18.24 KB | dawehner |
| #6 | interdiff.txt | 823 bytes | dawehner |
| #6 | drupal-1778356-6.patch | 18.19 KB | dawehner |
| #4 | drupal-1778356-4.patch | 17.74 KB | dawehner |
Comments
Comment #1
dawehnerGood idea!
What about storing the view object on the query plugin? Then we could fetch the base_table and base_field directly form there.
This would be automatically be there if we have unified the init methods.
Regarding the argument plugins, we could introduce a setArgument/getArgument and just call this in get_plugin of the argument plugin base.
Comment #2
dawehnerLet's start with the query plugins.
Comment #4
dawehnerRerolled for the getters method, and fixed some of bugs.
Comment #6
dawehnerAh getPlugin has to be adapted as well.
Comment #8
dawehnerWell, it would have been too nice.
Comment #9
aspilicious commentedNot yet done. I still see a mixture of
I would go with the 3th option everywhere
Comment #10
dawehnerThis patch just tries to fix init methods of query plugins.
Comment #11
aspilicious commentedThan this is done but we need an issue for the other part of the problem written in the original report.
Comment #12
tim.plunkett#8: drupal-1778356-8.patch queued for re-testing.
Comment #13
catchThanks! Committed/pushed to 8.x.