From 0113cdcf598f51c3a78d72aa3b93e9ddd52f6d2a Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Tue, 8 Sep 2015 11:13:52 -0600 Subject: [PATCH] Check to ensure template has modular templates before showing add modular button --- classes/admin.php | 11 +++++++++++ themes/grav/templates/pages.html.twig | 2 ++ 2 files changed, 13 insertions(+) diff --git a/classes/admin.php b/classes/admin.php index f7172350..1777de98 100644 --- a/classes/admin.php +++ b/classes/admin.php @@ -385,6 +385,17 @@ class Admin return $routes; } + /** + * Get All modular types + * + * @return array + */ + public function modularTypes() + { + return Pages::modularTypes(); + } + + /** * Get all plugins. * diff --git a/themes/grav/templates/pages.html.twig b/themes/grav/templates/pages.html.twig index e8d2826f..d650c163 100644 --- a/themes/grav/templates/pages.html.twig +++ b/themes/grav/templates/pages.html.twig @@ -108,7 +108,9 @@ {% if mode == 'list' %} {{ "PLUGIN_ADMIN.BACK"|tu }} {{ "PLUGIN_ADMIN.ADD_PAGE"|tu }} + {% if admin.modularTypes is not empty %} {{ "PLUGIN_ADMIN.ADD_MODULAR"|tu }} + {% endif %} {% if admin.multilang %}