Allow to see plugins and themes list without internet connection. Also add a more helpful message in the "add" view. re https://github.com/getgrav/grav/issues/1008

This commit is contained in:
Flavio Copes
2017-01-22 15:50:37 +01:00
parent d6afa39624
commit 2c58db3418
5 changed files with 40 additions and 18 deletions

View File

@@ -708,15 +708,21 @@ class Admin
return false;
}
return $local
? $gpm->getInstalledPlugins()
: $gpm->getRepositoryPlugins()->filter(function (
$package,
$slug
) use ($gpm) {
return !$gpm->isPluginInstalled($slug);
})
;
if ($local) {
return $gpm->getInstalledPlugins();
} else {
$plugins = $gpm->getRepositoryPlugins();
if ($plugins) {
return $plugins->filter(function (
$package,
$slug
) use ($gpm) {
return !$gpm->isPluginInstalled($slug);
});
} else {
return [];
}
}
}
/**
@@ -734,11 +740,21 @@ class Admin
return false;
}
return $local
? $gpm->getInstalledThemes()
: $gpm->getRepositoryThemes()->filter(function ($package, $slug) use ($gpm) {
return !$gpm->isThemeInstalled($slug);
});
if ($local) {
return $gpm->getInstalledThemes();
} else {
$themes = $gpm->getRepositoryThemes();
if ($themes) {
return $themes->filter(function (
$package,
$slug
) use ($gpm) {
return !$gpm->isThemeInstalled($slug);
});
} else {
return [];
}
}
}
/**