diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php
index 55cac15..36af70a 100644
--- a/DependencyInjection/Configuration.php
+++ b/DependencyInjection/Configuration.php
@@ -27,6 +27,7 @@ class Configuration implements ConfigurationInterface
->prototype('scalar')
->end()
->end()
+ ->booleanNode('default_sections_opened')->defaultValue(true)->end()
->arrayNode('motd')
->addDefaultsIfNotSet()
->children()
diff --git a/DependencyInjection/NelmioApiDocExtension.php b/DependencyInjection/NelmioApiDocExtension.php
index 4f07acd..87da66e 100644
--- a/DependencyInjection/NelmioApiDocExtension.php
+++ b/DependencyInjection/NelmioApiDocExtension.php
@@ -31,6 +31,7 @@ class NelmioApiDocExtension extends Extension
$container->setParameter('nelmio_api_doc.motd.template', $config['motd']['template']);
$container->setParameter('nelmio_api_doc.exclude_sections', $config['exclude_sections']);
+ $container->setParameter('nelmio_api_doc.default_sections_opened', $config['default_sections_opened']);
$container->setParameter('nelmio_api_doc.api_name', $config['name']);
$container->setParameter('nelmio_api_doc.sandbox.enabled', $config['sandbox']['enabled']);
$container->setParameter('nelmio_api_doc.sandbox.endpoint', $config['sandbox']['endpoint']);
diff --git a/Formatter/HtmlFormatter.php b/Formatter/HtmlFormatter.php
index 3b0b00c..94ab16f 100644
--- a/Formatter/HtmlFormatter.php
+++ b/Formatter/HtmlFormatter.php
@@ -75,6 +75,11 @@ class HtmlFormatter extends AbstractFormatter
*/
private $motdTemplate;
+ /**
+ * @var boolean
+ */
+ private $defaultSectionsOpened;
+
/**
* @param array $authentication
*/
@@ -179,6 +184,14 @@ class HtmlFormatter extends AbstractFormatter
return $this->motdTemplate;
}
+ /**
+ * @param boolean $defaultSectionsOpened
+ */
+ public function setDefaultSectionsOpened($defaultSectionsOpened)
+ {
+ $this->defaultSectionsOpened = $defaultSectionsOpened;
+ }
+
/**
* {@inheritdoc}
*/
@@ -212,20 +225,21 @@ class HtmlFormatter extends AbstractFormatter
private function getGlobalVars()
{
return array(
- 'apiName' => $this->apiName,
- 'authentication' => $this->authentication,
- 'endpoint' => $this->endpoint,
- 'enableSandbox' => $this->enableSandbox,
- 'requestFormatMethod' => $this->requestFormatMethod,
- 'acceptType' => $this->acceptType,
- 'bodyFormats' => $this->bodyFormats,
- 'defaultBodyFormat' => $this->defaultBodyFormat,
- 'requestFormats' => $this->requestFormats,
- 'defaultRequestFormat' => $this->defaultRequestFormat,
- 'date' => date(DATE_RFC822),
- 'css' => file_get_contents(__DIR__ . '/../Resources/public/css/screen.css'),
- 'js' => file_get_contents(__DIR__ . '/../Resources/public/js/all.js'),
- 'motdTemplate' => $this->motdTemplate
+ 'apiName' => $this->apiName,
+ 'authentication' => $this->authentication,
+ 'endpoint' => $this->endpoint,
+ 'enableSandbox' => $this->enableSandbox,
+ 'requestFormatMethod' => $this->requestFormatMethod,
+ 'acceptType' => $this->acceptType,
+ 'bodyFormats' => $this->bodyFormats,
+ 'defaultBodyFormat' => $this->defaultBodyFormat,
+ 'requestFormats' => $this->requestFormats,
+ 'defaultRequestFormat' => $this->defaultRequestFormat,
+ 'date' => date(DATE_RFC822),
+ 'css' => file_get_contents(__DIR__ . '/../Resources/public/css/screen.css'),
+ 'js' => file_get_contents(__DIR__ . '/../Resources/public/js/all.js'),
+ 'motdTemplate' => $this->motdTemplate,
+ 'defaultSectionsOpened' => $this->defaultSectionsOpened,
);
}
}
diff --git a/Resources/config/formatters.xml b/Resources/config/formatters.xml
index 832a33c..6aafe75 100644
--- a/Resources/config/formatters.xml
+++ b/Resources/config/formatters.xml
@@ -56,6 +56,9 @@