From 2fa9f799627cc64b0fc9ff40df339e53113491c3 Mon Sep 17 00:00:00 2001 From: Flavio Copes Date: Sat, 5 Sep 2015 11:55:22 +0200 Subject: [PATCH] Allow validating a page from outside the admin plugin This change allows a plugin to call validate() (which in turn calls blueprints()) on a page from the front, without needing the admin plugin to be active and set in the Grav object. --- system/src/Grav/Common/Page/Page.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/src/Grav/Common/Page/Page.php b/system/src/Grav/Common/Page/Page.php index 8983cfd5d..58304b14d 100644 --- a/system/src/Grav/Common/Page/Page.php +++ b/system/src/Grav/Common/Page/Page.php @@ -771,7 +771,7 @@ class Page $blueprint = $pages->blueprints($this->blueprintName()); $fields = $blueprint->fields(); - $edit_mode = self::getGrav()['admin'] ? self::getGrav()['config']->get('plugins.admin.edit_mode') : null; + $edit_mode = isset(self::getGrav()['admin']) ? self::getGrav()['config']->get('plugins.admin.edit_mode') : null; // override if you only want 'normal' mode if (empty($fields) && ($edit_mode == 'auto' || $edit_mode == 'normal')) {