Skip to content

Commit

Permalink
[Fix] Grav 1.1 (RC3) uses arrays instead of simple string for files u…
Browse files Browse the repository at this point in the history
…ploaded in plugins/themes. The plugin now works for Grav 1.0 and 1.1
  • Loading branch information
Sebastien VIALLEMONTEIL committed Jul 7, 2016
1 parent cedb2aa commit 7cd181f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
4 changes: 3 additions & 1 deletion aboutme.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 1 addition & 4 deletions blueprints.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 7cd181f

Please sign in to comment.