Skip to content
Snippets Groups Projects
Commit e07b9939 authored by Konstantinos Platis's avatar Konstantinos Platis
Browse files

Changed row-class form field to pre-filled / locked value to default

parent 0297c084
No related branches found
No related tags found
1 merge request!36Merge RC-v1.4.0 to master
......@@ -69,7 +69,8 @@ class Accordion extends DefaultStyle {
'#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' => (!empty($this->options['row_class'])) ? $this->options['row_class'] : 'carousel-cern-item',
'#default_value' => 'carousel-cern-item',
'#disabled' => true,
);
// Option to set a color for the accordion title
......
......@@ -51,5 +51,25 @@ class CardGrid extends DefaultStyle {
*/
protected $usesgrouping = true;
/**
* Overrides the options form of Card Grid
*
* @param $form
* @param FormStateInterface $form_state
*/
public function buildOptionsForm(&$form, FormStateInterface $form_state) {
parent::buildOptionsForm($form, $form_state);
}
\ No newline at end of file
$form['row_class'] = array(
'#type' => 'textfield',
'#title' => t('Row Class'),
'#description' => t(''),
'#default_value' => '',
'#disabled' => true,
);
}
}
\ No newline at end of file
......@@ -33,23 +33,24 @@ class Collision extends DefaultStyle {
*/
protected function defineOptions(){
$options = parent::defineOptions();
$options['row_class'] = array('default'=> 'events-collision-row') ;
$options['row_class'] = array('default'=> 'events-collision-row');
return $options;
}
/**
* Overrides the options form of HB
* Overrides the options form of Collision display format
*
* @param $form
* @param FormStateInterface $form_state
*/
public function buildOptionsForm(&$form, FormStateInterface $form_state) {
public function buildOptionsForm(&$form, FormStateInterface $form_state){
parent::buildOptionsForm($form, $form_state);
$form['row_class'] = array(
'#type' => 'textfield',
'#title' => t('Row Class'),
'#default_value' => (!empty($this->options['row_class'])) ? $this->options['row_class'] : 'events-collision-row',
'#default_value' => 'events-collision-row',
'#disabled' => true,
);
}
......
......@@ -3,7 +3,7 @@
namespace Drupal\cern_display_formats\Plugin\views\style;
use Drupal\core\form\FormStateInterface;
use Drupal\views\Plugin\views\style\DefaultStyle;
/**
......@@ -24,6 +24,11 @@ class Countdown extends DefaultStyle {
protected $usesoptions = true;
protected $usesRowPlugin = true;
//the format should not use row classes
protected $usesRowClass = true;
/**
* Defines the initial options for Countdown format
......@@ -32,8 +37,18 @@ 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
......@@ -34,5 +34,21 @@ class EventGrid extends DefaultStyle {
protected $renderFields = true;
/**
* Overrides the options form of Event Grid
*
* @param $form
* @param FormStateInterface $form_state
*/
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
......@@ -5,6 +5,7 @@ namespace Drupal\cern_display_formats\Plugin\views\style;
use Drupal\views\Plugin\views\style\DefaultStyle;
use Drupal\core\form\FormStateInterface;
/**
* Implements the Featured Banner display format
......@@ -22,8 +23,12 @@ use Drupal\views\Plugin\views\style\DefaultStyle;
*/
class FeaturedBanner extends DefaultStyle {
protected $usesoptions = true;
protected $usesRowPlugin = true;
protected $usesRowClass = true;
/**
* Defines the initial options for the Featured Banner format
......@@ -35,5 +40,23 @@ class FeaturedBanner extends DefaultStyle {
return $options;
}
/**
* Overrides the options form of Featured Banner
*
* @param $form
* @param FormStateInterface $form_state
*/
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
......@@ -59,7 +59,8 @@ class HorizontalBoxes extends DefaultStyle
'#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' => (!empty($this->options['row_class'])) ? $this->options['row_class'] : 'horizontal-boxes-row',
'#default_value' => 'horizontal-boxes-row',
'#disabled' => true,
);
}
......
......@@ -39,6 +39,7 @@ class TeaserList extends DefaultStyle
$options = parent::defineOptions();
$options['title_color'] = array('default'=> '#2574b9') ;
$options['title_color_card'] = array('default' => '#FFFFFF');
$options['row_class'] = array('default' => '');
return $options;
}
......@@ -51,6 +52,14 @@ 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,
);
// Option to set a color for the teaser list title
$form['title_color'] = array(
'#type' => 'color',
......
......@@ -22,11 +22,20 @@ use Drupal\views\Plugin\views\style\DefaultStyle;
*/
class VerticalBoxes extends DefaultStyle {
/**
* {@inheritdoc}
*/
protected $usesRowPlugin = true;
protected $usesRowClass = false;
protected $usesoptions = true;
protected $renderFields = true;
/**
* Defines the initial options for Countdown format
* Defines the initial options for Vertical Boxes format
*
* @return mixed
*/
......@@ -35,5 +44,23 @@ class VerticalBoxes extends DefaultStyle {
return $options;
}
/**
* Overrides the options form of Vertical Boxes
*
* @param $form
* @param FormStateInterface $form_state
*/
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
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