Skip to content
Snippets Groups Projects
Commit 1d3c0e4f authored by Stephen Mustgrave's avatar Stephen Mustgrave
Browse files

Issue #3280824 by nickdickinsonwilde, gloomcheng, nikhil_110: Accordion Tabs...

Issue #3280824 by nickdickinsonwilde, gloomcheng, nikhil_110: Accordion Tabs config isn't initialized on Quick Tab instance edit form
parent da1bdb82
No related branches found
No related tags found
3 merge requests!21Issue #3407343 Add theme template for loading animation/markup,!14Issue #3189439: Last clicked tab history should be configurable,!11Issue #3238148: Tabs still displayed even when empty
Pipeline #364671 passed with warnings
......@@ -22,7 +22,7 @@ class AccordionTabs extends TabRendererBase {
* {@inheritdoc}
*/
public function optionsForm(QuickTabsInstance $instance): array {
$options = $instance->getOptions()['accordion_tabs'];
$options = $instance->getOptions()['accordion_tabs'] ?? $this->defaultConfiguration();
$form = [];
$form['jquery_ui'] = [
'#type' => 'fieldset',
......@@ -31,7 +31,7 @@ class AccordionTabs extends TabRendererBase {
$form['jquery_ui']['collapsible'] = [
'#type' => 'checkbox',
'#title' => $this->t('Collapsible'),
'#default_value' => ($options['jquery_ui']['collapsible'] != NULL && $instance->getRenderer() == 'accordion_tabs') ? $options['jquery_ui']['collapsible'] : 0,
'#default_value' => $options['jquery_ui']['collapsible'],
];
$form['jquery_ui']['heightStyle'] = [
'#type' => 'radios',
......@@ -41,7 +41,7 @@ class AccordionTabs extends TabRendererBase {
'fill' => $this->t('fill'),
'content' => $this->t('content'),
],
'#default_value' => ($options['jquery_ui']['heightStyle'] != NULL && $instance->getRenderer() == 'accordion_tabs') ? $options['jquery_ui']['heightStyle'] : 'auto',
'#default_value' => $options['jquery_ui']['heightStyle'],
];
return $form;
}
......@@ -117,4 +117,18 @@ class AccordionTabs extends TabRendererBase {
return $build;
}
/**
* Get the default configuration.
*
* @return array[]
*/
private function defaultConfiguration(): array {
return [
'jquery_ui' => [
'collapsible' => 0,
'heightStyle' => 'auto',
],
];
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment