diff --git a/lib/Drupal/views/Plugin/views/style/DefaultStyle.php b/lib/Drupal/views/Plugin/views/style/DefaultStyle.php index 05e2cb32e639c97cf8dece8e6c14c309888d0428..a98c3faa1860048e31553e5377843f0010d66b9d 100644 --- a/lib/Drupal/views/Plugin/views/style/DefaultStyle.php +++ b/lib/Drupal/views/Plugin/views/style/DefaultStyle.php @@ -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" * ) diff --git a/lib/Drupal/views/Plugin/views/style/StylePluginBase.php b/lib/Drupal/views/Plugin/views/style/StylePluginBase.php index a8d2f45300fe01f4aedc5070b22a74ffdce87704..74d30f332e5c71ce0079b54922f62ab02856a544 100644 --- a/lib/Drupal/views/Plugin/views/style/StylePluginBase.php +++ b/lib/Drupal/views/Plugin/views/style/StylePluginBase.php @@ -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;