Skip to content
Snippets Groups Projects
Commit bc308540 authored by Angie Byron's avatar Angie Byron
Browse files

Issue #2099343 by damiankloip: Clean up Views relationship plugins.

parent 9a598b7c
No related branches found
No related tags found
No related merge requests found
......@@ -7,8 +7,6 @@
namespace Drupal\views\Plugin\views\relationship;
use Drupal\Component\Annotation\PluginID;
/**
* A special handler to take the place of missing or broken handlers.
*
......@@ -18,6 +16,9 @@
*/
class Broken extends RelationshipPluginBase {
/**
* {@inheritdoc}
*/
public function adminLabel($short = FALSE) {
$args = array(
'@module' => $this->definition['original_configuration']['provider'],
......@@ -25,9 +26,26 @@ public function adminLabel($short = FALSE) {
return $this->isOptional() ? t('Optional handler is missing (Module: @module) …', $args) : t('Broken/missing handler (Module: @module) …', $args);
}
public function defineOptions() { return array(); }
public function ensureMyTable() { /* No table to ensure! */ }
public function query() { /* No query to run */ }
/**
* {@inheritdoc}
*/
protected function defineOptions() {
return array();
}
/**
* {@inheritdoc}
*/
public function ensureMyTable() {
// No table to ensure.
}
/**
* {@inheritdoc}
*/
public function query() {
// No query to run.
}
/**
* {@inheritdoc}
......@@ -67,8 +85,10 @@ public function buildOptionsForm(&$form, &$form_state) {
}
/**
* Determine if the handler is considered 'broken'
* {@inheritdoc}
*/
public function broken() { return TRUE; }
public function broken() {
return TRUE;
}
}
......@@ -8,8 +8,6 @@
namespace Drupal\views\Plugin\views\relationship;
use Drupal\Core\Database\Query\AlterableInterface;
use Drupal\views\ViewExecutable;
use Drupal\Component\Annotation\PluginID;
use Drupal\views\Views;
/**
......@@ -65,7 +63,7 @@
class GroupwiseMax extends RelationshipPluginBase {
/**
* Defines default values for options.
* {@inheritdoc}
*/
protected function defineOptions() {
$options = parent::defineOptions();
......@@ -81,8 +79,7 @@ protected function defineOptions() {
}
/**
* Extends the relationship's basic options, allowing the user to pick
* a sort and an order for it.
* {@inheritdoc}
*/
public function buildOptionsForm(&$form, &$form_state) {
parent::buildOptionsForm($form, $form_state);
......@@ -94,6 +91,8 @@ public function buildOptionsForm(&$form, &$form_state) {
}
$base_table_data = Views::viewsData()->get($this->definition['base']);
// Extends the relationship's basic options, allowing the user to pick a
// sort and an order for it.
$form['subquery_sort'] = array(
'#type' => 'select',
'#title' => t('Representative sort criteria'),
......@@ -332,9 +331,7 @@ protected function conditionNamespace($string) {
}
/**
* Called to implement a relationship in a query.
* This is mostly a copy of our parent's query() except for this bit with
* the join class.
* {@inheritdoc}
*/
public function query() {
// Figure out what base table this relationship brings to the party.
......
......@@ -11,7 +11,6 @@
use Drupal\views\Plugin\views\display\DisplayPluginBase;
use Drupal\views\Plugin\views\HandlerBase;
use Drupal\views\Join;
use Drupal\Component\Annotation\Plugin;
use Drupal\views\Views;
/**
......@@ -65,6 +64,16 @@ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$o
}
}
/**
* {@inheritdoc}
*/
public function usesGroupBy() {
return FALSE;
}
/**
* {@inheritdoc}
*/
protected function defineOptions() {
$options = parent::defineOptions();
......@@ -83,8 +92,7 @@ protected function defineOptions() {
}
/**
* Default options form that provides the label widget that all fields
* should have.
* {@inheritdoc}
*/
public function buildOptionsForm(&$form, &$form_state) {
parent::buildOptionsForm($form, $form_state);
......@@ -101,7 +109,7 @@ public function buildOptionsForm(&$form, &$form_state) {
}
/**
* Called to implement a relationship in a query.
* {@inheritdoc}
*/
public function query() {
// Figure out what base table this relationship brings to the party.
......@@ -144,13 +152,6 @@ public function query() {
}
}
/**
* You can't groupby a relationship.
*/
public function usesGroupBy() {
return FALSE;
}
}
/**
......
......@@ -7,8 +7,6 @@
namespace Drupal\views\Plugin\views\relationship;
use Drupal\Component\Annotation\PluginID;
/**
* Default implementation of the base relationship plugin.
*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment