Skip to content
Snippets Groups Projects

Resolve "When creating a FAQ with the viewtype accordeon it will group them in a wrong way"

5 files
+ 29
50
Compare changes
  • Side-by-side
  • Inline
Files
5
@@ -13,15 +13,12 @@ use Drupal\views\Plugin\views\style\DefaultStyle;
@@ -13,15 +13,12 @@ use Drupal\views\Plugin\views\style\DefaultStyle;
* id = "accordion",
* id = "accordion",
* title = @Translation("Accordion"),
* title = @Translation("Accordion"),
* help = @Translation("Displays content in an accordion style"),
* help = @Translation("Displays content in an accordion style"),
* theme = "views_view_accordion",
* theme = "views_view_unformatted",
* display_types = {"normal"}
* display_types = {"normal"}
* )
* )
*/
*/
class Accordion extends DefaultStyle
class Accordion extends DefaultStyle {
{
/**
* {@inheritdoc}
*/
protected $usesRowPlugin = true;
protected $usesRowPlugin = true;
/**
/**
@@ -33,12 +30,34 @@ class Accordion extends DefaultStyle
@@ -33,12 +30,34 @@ class Accordion extends DefaultStyle
protected $usesoptions = true;
protected $usesoptions = true;
protected $renderFields = true;
protected $renderFields = true;
 
/**
 
* Defines the initial options of the Horizontal Boxes.
 
*
 
* @return mixed
 
*/
protected function defineOptions(){
protected function defineOptions(){
$options = parent::defineOptions();
$options = parent::defineOptions();
 
$options['row_class'] = array('default'=> 'carousel-cern-item') ;
return $options;
return $options;
}
}
 
/**
 
* Overrides the options form of Accordion
 
*
 
* @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('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',
 
);
 
}
 
}
}
 
\ No newline at end of file
Loading