From 7cd181f7fb2b88ff3ac91a4429645b49c13818a0 Mon Sep 17 00:00:00 2001 From: Sebastien VIALLEMONTEIL Date: Thu, 7 Jul 2016 10:06:20 +0200 Subject: [PATCH] [Fix] Grav 1.1 (RC3) uses arrays instead of simple string for files uploaded in plugins/themes. The plugin now works for Grav 1.0 and 1.1 --- aboutme.php | 4 +++- blueprints.yaml | 5 +---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/aboutme.php b/aboutme.php index f932daf..ffa3d3c 100755 --- a/aboutme.php +++ b/aboutme.php @@ -53,7 +53,9 @@ public function onTwigSiteVariables() $twig->twig_vars['aboutme_description'] = $this->config->get('plugins.aboutme.description'); $twig->twig_vars['aboutme_picture_src'] = $this->config->get('plugins.aboutme.gravatar.enabled') ? $this->getGravatarUrl() : $this->config->get('plugins.aboutme.picture_src'); - + if (is_array($twig->twig_vars['aboutme_picture_src'])) { // grav 1.1 gives an array instead of a simple string + $twig->twig_vars['aboutme_picture_src'] = key($twig->twig_vars['aboutme_picture_src']); + } $pages = $this->config->get('plugins.aboutme.social_pages.pages'); uasort($pages, function($a, $b) { return $a['position'] < $b['position'] ? -1 : $a['position'] == $b['position'] ? 0 : 1; diff --git a/blueprints.yaml b/blueprints.yaml index 3baa6d7..ed98bc9 100755 --- a/blueprints.yaml +++ b/blueprints.yaml @@ -59,10 +59,7 @@ form: label: Picture file multiple: false destination: 'user/plugins/aboutme/assets/avatars' - showuploaded: true - showuploadedpreview: true - ispluginconfig: true - pluginname: 'aboutme' + blueprint: plugin.aboutme accept: - image/* Gravatar: