Commit 21a78c53 authored by bellesmanieres's avatar bellesmanieres Committed by tim.plunkett
Browse files

Issue #1756656 by bellesmanieres | tim.plunkett: Move uses_grouping() from...

Issue #1756656 by bellesmanieres | tim.plunkett: Move uses_grouping() from plugin annotation to a class property.
parent 7d3972ec
......@@ -21,7 +21,6 @@
* title = @Translation("Unformatted list"),
* help = @Translation("Displays rows one after another."),
* theme = "views_view_unformatted",
* uses_grouping = TRUE,
* type = "normal",
* help_topic = "style-unformatted"
* )
......
......@@ -63,6 +63,13 @@ abstract class StylePluginBase extends PluginBase {
*/
protected $usesRowClass = FALSE;
/**
* Does the style plugin support grouping of rows.
*
* @var bool
*/
protected $usesGrouping = TRUE;
/**
* Does the style plugin for itself support to add fields to it's output.
*
......@@ -97,9 +104,6 @@ function init(&$view, &$display, $options = NULL) {
'grouping' => array(),
);
$this->definition += array(
'uses_grouping' => TRUE,
);
}
function destroy() {
......@@ -129,6 +133,15 @@ function usesRowClass() {
return $this->usesRowClass;
}
/**
* Returns the usesGrouping property.
*
* @return bool
*/
function usesGrouping() {
return $this->usesGrouping;
}
/**
* Return TRUE if this style also uses fields.
*
......@@ -224,10 +237,10 @@ function option_definition() {
function options_form(&$form, &$form_state) {
parent::options_form($form, $form_state);
// Only fields-based views can handle grouping. Style plugins can also exclude
// themselves from being groupable by setting their "use grouping" definiton
// key to FALSE.
// @TODO: Document "uses grouping" in docs.php when docs.php is written.
if ($this->usesFields() && $this->definition['uses_grouping']) {
// themselves from being groupable by setting their "usesGrouping" property
// to FALSE.
// @TODO: Document "usesGrouping" in docs.php when docs.php is written.
if ($this->usesFields() && $this->usesGrouping()) {
$options = array('' => t('- None -'));
$field_labels = $this->display->handler->get_field_labels(TRUE);
$options += $field_labels;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment