From c03d972512d81845c0f7f58275b6e31074181b5e Mon Sep 17 00:00:00 2001 From: github-actions Date: Sun, 26 Nov 2023 19:46:56 +0000 Subject: [PATCH] Merge pull request #1477 from hydephp/documentation-sidebar-footer-configuration-option Update configuration option for the documentation sidebar footer to allow custom Markdown to be specified https://github.com/hydephp/develop/commit/b4e6831175a4e312431cdaf936c7c3a26403fc68 --- config/docs.php | 3 ++- .../components/docs/sidebar-footer-text.blade.php | 6 +++++- resources/views/components/docs/sidebar.blade.php | 2 +- tests/Feature/SidebarViewTest.php | 11 +++++++++++ 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/config/docs.php b/config/docs.php index fe9cf452..fab400e9 100644 --- a/config/docs.php +++ b/config/docs.php @@ -30,7 +30,8 @@ // When using a grouped sidebar, should the groups be collapsible? 'collapsible' => true, - // Should the sidebar footer be shown? + // Should the sidebar footer be shown? You can also set this to a string + // of Markdown to show in the footer. Set to `false` to disable. 'footer' => true, ], diff --git a/resources/views/components/docs/sidebar-footer-text.blade.php b/resources/views/components/docs/sidebar-footer-text.blade.php index 4bafb848..6b49ca39 100644 --- a/resources/views/components/docs/sidebar-footer-text.blade.php +++ b/resources/views/components/docs/sidebar-footer-text.blade.php @@ -1,3 +1,7 @@

- Back to home page + @if(is_bool(config('docs.sidebar.footer', true))) + Back to home page + @else + {{ Hyde::markdown(config('docs.sidebar.footer')) }} + @endif

\ No newline at end of file diff --git a/resources/views/components/docs/sidebar.blade.php b/resources/views/components/docs/sidebar.blade.php index 9d8872bc..04b9857a 100644 --- a/resources/views/components/docs/sidebar.blade.php +++ b/resources/views/components/docs/sidebar.blade.php @@ -7,7 +7,7 @@ 'sidebar' => \Hyde\Framework\Features\Navigation\DocumentationSidebar::create(), ]) - @if(config('docs.sidebar.footer', true)) + @if(config('docs.sidebar.footer', true) !== false) diff --git a/tests/Feature/SidebarViewTest.php b/tests/Feature/SidebarViewTest.php index 53843c6c..44840e64 100644 --- a/tests/Feature/SidebarViewTest.php +++ b/tests/Feature/SidebarViewTest.php @@ -65,6 +65,17 @@ public function testBaseSidebarWithoutFooter() $this->assertViewWasNotRendered(view('hyde::components.docs.sidebar-footer-text')); } + public function testBaseSidebarWithCustomFooterText() + { + config(['docs.sidebar.footer' => 'My **Markdown** Footer Text']); + + $this->renderComponent(view('hyde::components.docs.sidebar')) + ->assertSeeHtml('