diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php
index 50550a3..7a90cb6 100644
--- a/DependencyInjection/Configuration.php
+++ b/DependencyInjection/Configuration.php
@@ -23,6 +23,12 @@ class Configuration implements ConfigurationInterface
->root('nelmio_api_doc')
->children()
->scalarNode('name')->defaultValue('API documentation')->end()
+ ->arrayNode('motd')
+ ->addDefaultsIfNotSet()
+ ->children()
+ ->scalarNode('template')->defaultValue('NelmioApiDocBundle::Components/motd.html.twig')->end()
+ ->end()
+ ->end()
->arrayNode('request_listener')
->beforeNormalization()
->ifTrue(function ($a) { return is_bool($a); })
diff --git a/DependencyInjection/NelmioApiDocExtension.php b/DependencyInjection/NelmioApiDocExtension.php
index 2718679..ce10263 100644
--- a/DependencyInjection/NelmioApiDocExtension.php
+++ b/DependencyInjection/NelmioApiDocExtension.php
@@ -28,6 +28,7 @@ class NelmioApiDocExtension extends Extension
$configuration = new Configuration();
$config = $processor->processConfiguration($configuration, $configs);
+ $container->setParameter('nelmio_api_doc.motd.template', $config['motd']['template']);
$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 9d5449f..d4520fc 100644
--- a/Formatter/HtmlFormatter.php
+++ b/Formatter/HtmlFormatter.php
@@ -55,6 +55,11 @@ class HtmlFormatter extends AbstractFormatter
*/
private $authentication;
+ /**
+ * @var string
+ */
+ private $motdTemplate;
+
/**
* @param array $authentication
*/
@@ -119,6 +124,22 @@ class HtmlFormatter extends AbstractFormatter
$this->defaultRequestFormat = $format;
}
+ /**
+ * @param string $motdTemplate
+ */
+ public function setMotdTemplate($motdTemplate)
+ {
+ $this->motdTemplate = $motdTemplate;
+ }
+
+ /**
+ * @return string
+ */
+ public function getMotdTemplate()
+ {
+ return $this->motdTemplate;
+ }
+
/**
* {@inheritdoc}
*/
@@ -162,6 +183,7 @@ class HtmlFormatter extends AbstractFormatter
'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
);
}
}
diff --git a/Resources/config/formatters.xml b/Resources/config/formatters.xml
index 98f29c5..8a21d80 100644
--- a/Resources/config/formatters.xml
+++ b/Resources/config/formatters.xml
@@ -28,6 +28,9 @@
+ Documentation auto-generated on {{ date }} +
\ No newline at end of file diff --git a/Resources/views/layout.html.twig b/Resources/views/layout.html.twig index 967c105..6f2c29d 100644 --- a/Resources/views/layout.html.twig +++ b/Resources/views/layout.html.twig @@ -27,6 +27,7 @@