diff --git a/lib/Drupal/views/Plugin/views/style/DefaultStyle.php b/lib/Drupal/views/Plugin/views/style/DefaultStyle.php index 05e2cb3..a98c3fa 100644 --- a/lib/Drupal/views/Plugin/views/style/DefaultStyle.php +++ b/lib/Drupal/views/Plugin/views/style/DefaultStyle.php @@ -21,7 +21,6 @@ use Drupal\Core\Annotation\Translation; * 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 a8d2f45..92aec65 100644 --- a/lib/Drupal/views/Plugin/views/style/StylePluginBase.php +++ b/lib/Drupal/views/Plugin/views/style/StylePluginBase.php @@ -64,6 +64,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. * * This option only makes sense on style plugins without row plugins, like @@ -97,9 +104,6 @@ abstract class StylePluginBase extends PluginBase { 'grouping' => array(), ); - $this->definition += array( - 'uses_grouping' => TRUE, - ); } function destroy() { @@ -130,6 +134,15 @@ abstract class StylePluginBase extends PluginBase { } /** + * Returns the usesGrouping property. + * + * @return bool + */ + function usesGrouping() { + return $this->usesGrouping; + } + + /** * Return TRUE if this style also uses fields. * * @return bool @@ -224,10 +237,9 @@ abstract class StylePluginBase extends PluginBase { 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;