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.
This commit is contained in:
Flavio Copes
2015-09-05 11:55:22 +02:00
parent 8fdac33219
commit 2fa9f79962

View File

@@ -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')) {