From a0adf2866c31428440e534ef4b199167a22240fc Mon Sep 17 00:00:00 2001
From: Konstantinos Platis <konstantinos.platis@cern.ch>
Date: Wed, 16 Sep 2020 14:52:46 +0200
Subject: [PATCH] Remove disabling of row classes in display formats

---
 CHANGELOG.md                               |  1 +
 src/Plugin/views/style/Accordion.php       | 10 ----------
 src/Plugin/views/style/CardGrid.php        |  9 ---------
 src/Plugin/views/style/Collision.php       | 16 +++-------------
 src/Plugin/views/style/Countdown.php       |  8 --------
 src/Plugin/views/style/EventGrid.php       |  8 --------
 src/Plugin/views/style/FeaturedBanner.php  |  8 --------
 src/Plugin/views/style/HorizontalBoxes.php | 17 +++--------------
 src/Plugin/views/style/TeaserList.php      | 19 -------------------
 src/Plugin/views/style/VerticalBoxes.php   | 12 +-----------
 10 files changed, 8 insertions(+), 100 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7a99793..6434307 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 ## [1.4.3]
 - Apply fix for Owl Carousel library loading in Horizontal Boxes view display format
 - Modify display formats to keep css classes added manually in view config
+- Remove disabling of row classes in display formats
 
 ## [1.4.2] - 25/05/2020
 - Removed library declaration of JS file that does not exist
diff --git a/src/Plugin/views/style/Accordion.php b/src/Plugin/views/style/Accordion.php
index a45ac82..8614322 100644
--- a/src/Plugin/views/style/Accordion.php
+++ b/src/Plugin/views/style/Accordion.php
@@ -51,7 +51,6 @@ class Accordion extends DefaultStyle {
 	 */
 	protected function defineOptions(){
 		$options = parent::defineOptions();
-		$options['row_class'] = array('default'=> 'carousel-cern-item') ;
 		return $options;
 	}
 
@@ -63,15 +62,6 @@ class Accordion extends DefaultStyle {
 	 */
 	public function buildOptionsForm(&$form, FormStateInterface $form_state) {
 		parent::buildOptionsForm($form, $form_state);
-
-		$form['row_class'] = array(
-				'#type' => 'textfield',
-				'#title' => t('Row Class'),
-				'#description' => t('For Accordion, make sure you have set carousel-cern-item as one of the row classes'),
-				'#default_value' => 'carousel-cern-item',
-				'#disabled' => true,
-		);
-
 	}
 
 }
\ No newline at end of file
diff --git a/src/Plugin/views/style/CardGrid.php b/src/Plugin/views/style/CardGrid.php
index 5614e9c..1327b0d 100644
--- a/src/Plugin/views/style/CardGrid.php
+++ b/src/Plugin/views/style/CardGrid.php
@@ -59,15 +59,6 @@ class CardGrid extends DefaultStyle {
 		 */
 	public function buildOptionsForm(&$form, FormStateInterface $form_state) {
 		parent::buildOptionsForm($form, $form_state);
-
-		$form['row_class'] = array(
-				'#type' => 'textfield',
-				'#title' => t('Row Class'),
-				'#description' => t(''),
-				'#default_value' =>  '',
-				'#disabled' => true,
-		);
-
 	}
 
 
diff --git a/src/Plugin/views/style/Collision.php b/src/Plugin/views/style/Collision.php
index a9f6a7a..eb994f7 100644
--- a/src/Plugin/views/style/Collision.php
+++ b/src/Plugin/views/style/Collision.php
@@ -26,17 +26,6 @@ class Collision extends DefaultStyle {
 	protected $usesoptions = true;
 
 
-	/**
-	 * Defines the initial options of the Horizontal Boxes.
-	 *
-	 * @return mixed
-	 */
-	protected function defineOptions(){
-		$options = parent::defineOptions();
-		$options['row_class'] = array('default'=> 'events-collision-row');
-		return $options;
-	}
-
 	/**
 	 * Overrides the options form of Collision display format
 	 *
@@ -49,8 +38,9 @@ class Collision extends DefaultStyle {
 		$form['row_class'] = array(
 				'#type' => 'textfield',
 				'#title' => t('Row Class'),
-				'#default_value' => 'events-collision-row',
-				'#disabled' => true,
+				'#description' => t(' The classes to provide on each row. Make sure to have the value <strong>events-collision-row</strong>'),
+				'#default_value' => ($this->options['row_class'] == '' ? 'events-collision-row' : $this->options['row_class']),
+				'#disabled' => false,
 		);
 	}
 
diff --git a/src/Plugin/views/style/Countdown.php b/src/Plugin/views/style/Countdown.php
index 307f363..06649c8 100644
--- a/src/Plugin/views/style/Countdown.php
+++ b/src/Plugin/views/style/Countdown.php
@@ -37,18 +37,10 @@ class Countdown extends DefaultStyle {
 	 */
 	protected function defineOptions(){
 		$options = parent::defineOptions();
-		$options['row_class'] = array('default'=> '');
 		return $options;
 	}
 
 	public function buildOptionsForm(&$form, FormStateInterface $form_state){
 		parent::buildOptionsForm($form, $form_state);
-
-		$form['row_class'] = array(
-				'#type' => 'textfield',
-				'#title' => t('Row Class'),
-				'#default_value' => '',
-				'#disabled' => true,
-		);
 	}
 }
\ No newline at end of file
diff --git a/src/Plugin/views/style/EventGrid.php b/src/Plugin/views/style/EventGrid.php
index e6a9834..8e01ed6 100644
--- a/src/Plugin/views/style/EventGrid.php
+++ b/src/Plugin/views/style/EventGrid.php
@@ -42,13 +42,5 @@ class EventGrid extends DefaultStyle {
 	 */
 	public function buildOptionsForm(&$form, FormStateInterface $form_state) {
 		parent::buildOptionsForm($form, $form_state);
-
-		$form['row_class'] = array(
-				'#type' => 'textfield',
-				'#title' => t('Row Class'),
-				'#description' => t(''),
-				'#default_value' => '',
-				'#disabled' => true,
-		);
 	}
 }
\ No newline at end of file
diff --git a/src/Plugin/views/style/FeaturedBanner.php b/src/Plugin/views/style/FeaturedBanner.php
index ebf804b..3cae1f9 100644
--- a/src/Plugin/views/style/FeaturedBanner.php
+++ b/src/Plugin/views/style/FeaturedBanner.php
@@ -48,14 +48,6 @@ class FeaturedBanner extends DefaultStyle {
 	 */
 	public function buildOptionsForm(&$form, FormStateInterface $form_state) {
 		parent::buildOptionsForm($form, $form_state);
-
-		$form['row_class'] = array(
-				'#type' => 'textfield',
-				'#title' => t('Row Class'),
-				'#description' => t(''),
-				'#default_value' => '',
-				'#disabled' => true,
-		);
 	}
 
 
diff --git a/src/Plugin/views/style/HorizontalBoxes.php b/src/Plugin/views/style/HorizontalBoxes.php
index ab74973..c5dc0f2 100755
--- a/src/Plugin/views/style/HorizontalBoxes.php
+++ b/src/Plugin/views/style/HorizontalBoxes.php
@@ -35,17 +35,6 @@ class HorizontalBoxes extends DefaultStyle
 
     protected $renderFields = true;
 
-	/**
-	 * Defines the initial options of the Horizontal Boxes.
-	 *
-	 * @return mixed
-	 */
-    protected function defineOptions(){
-      $options = parent::defineOptions();
-      $options['row_class'] = array('default'=> 'horizontal-boxes-row') ;
-      return $options;
-    }
-
 	/**
 	 * Overrides the options form of HB
 	 *
@@ -58,9 +47,9 @@ class HorizontalBoxes extends DefaultStyle
 		$form['row_class'] = array(
 				'#type' => 'textfield',
 				'#title' => t('Row Class'),
-				'#description' => t('For Horizontal Boxes, make sure you have set horizontal-boxes-row as one of the row classes'),
-				'#default_value' => 'horizontal-boxes-row',
-				'#disabled' => true,
+				'#description' => t(' The classes to provide on each row. Make sure to have the value <strong>horizontal-boxes-row</strong>'),
+				'#default_value' => ($this->options['row_class'] == '' ? 'horizontal-boxes-row' : $this->options['row_class']),
+				'#disabled' => false,
 		);
 	}
 
diff --git a/src/Plugin/views/style/TeaserList.php b/src/Plugin/views/style/TeaserList.php
index d262529..8aff1fc 100644
--- a/src/Plugin/views/style/TeaserList.php
+++ b/src/Plugin/views/style/TeaserList.php
@@ -30,16 +30,6 @@ class TeaserList extends DefaultStyle
 
     protected $usesoptions = true;
 
-	/**
-	 * Defines the initial options of the Teaser List.
-	 *
-	 * @return mixed
-	 */
-	protected function defineOptions(){
-		$options = parent::defineOptions();
-		$options['row_class'] = array('default' => '');
-		return $options;
-	}
 
 	/**
 	 * Overrides the options form of Teaser List
@@ -49,15 +39,6 @@ class TeaserList extends DefaultStyle
 	 */
 	public function buildOptionsForm(&$form, FormStateInterface $form_state) {
 		parent::buildOptionsForm($form, $form_state);
-
-		$form['row_class'] = array(
-				'#type' => 'textfield',
-				'#title' => t('Row Class'),
-				'#description' => t(''),
-				'#default_value' => '',
-				'#disabled' => true,
-		);
-
 	}
 
 }
diff --git a/src/Plugin/views/style/VerticalBoxes.php b/src/Plugin/views/style/VerticalBoxes.php
index be72955..df529ac 100644
--- a/src/Plugin/views/style/VerticalBoxes.php
+++ b/src/Plugin/views/style/VerticalBoxes.php
@@ -28,7 +28,7 @@ class VerticalBoxes extends DefaultStyle {
 	 */
 	protected $usesRowPlugin = true;
 
-	protected $usesRowClass = false;
+	protected $usesRowClass = true;
 
 	protected $usesoptions = true;
 
@@ -53,15 +53,5 @@ class VerticalBoxes extends DefaultStyle {
 	 */
 	public function buildOptionsForm(&$form, FormStateInterface $form_state) {
 		parent::buildOptionsForm($form, $form_state);
-
-		$form['row_class'] = array(
-				'#type' => 'textfield',
-				'#title' => t('Row Class'),
-				'#description' => t(''),
-				'#default_value' => '',
-				'#disabled' => true,
-		);
 	}
-
-
 }
\ No newline at end of file
-- 
GitLab