mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2026-05-05 19:45:31 +02:00
Better way to get plugin version
This commit is contained in:
10
admin.php
10
admin.php
@@ -66,6 +66,8 @@ class AdminPlugin extends Plugin
|
||||
*/
|
||||
protected $base;
|
||||
|
||||
protected $version;
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
@@ -243,6 +245,13 @@ class AdminPlugin extends Plugin
|
||||
// Only activate admin if we're inside the admin path.
|
||||
if ($this->active) {
|
||||
|
||||
// Store this version and prefer newer method
|
||||
if (method_exists($this, 'getBlueprint')) {
|
||||
$this->version = $this->getBlueprint()->version;
|
||||
} else {
|
||||
$this->version = $this->grav['plugins']->get('admin')->blueprints()->version;
|
||||
}
|
||||
|
||||
// Test for correct Grav 1.1 version
|
||||
if (version_compare(GRAV_VERSION, '1.1.0-beta.1', '<')) {
|
||||
$messages = $this->grav['messages'];
|
||||
@@ -439,6 +448,7 @@ class AdminPlugin extends Plugin
|
||||
$twig->twig_vars['base_url'] = $twig->twig_vars['base_url_relative'];
|
||||
$twig->twig_vars['base_path'] = GRAV_ROOT;
|
||||
$twig->twig_vars['admin'] = $this->admin;
|
||||
$twig->twig_vars['admin_version'] = $this->version;
|
||||
|
||||
// Gather Plugin-hooked nav items
|
||||
$this->grav->fireEvent('onAdminMenu');
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
{% block content_bottom %}{% endblock %}
|
||||
</div>
|
||||
<footer id="footer">
|
||||
<a href="http://getgrav.org">Grav</a> v<span class="grav-version">{{ constant('GRAV_VERSION') }}</span> - Admin v{{ admin.gpm.getInstalledPlugin('admin').version }} - {{ "PLUGIN_ADMIN.WAS_MADE_WITH"|tu|lower }} <i class="fa fa-heart"></i> {{ "PLUGIN_ADMIN.BY"|tu|lower }} <a href="http://www.rockettheme.com">RocketTheme</a>.
|
||||
<a href="http://getgrav.org">Grav</a> v<span class="grav-version">{{ constant('GRAV_VERSION') }}</span> - Admin v{{ admin_version }} - {{ "PLUGIN_ADMIN.WAS_MADE_WITH"|tu|lower }} <i class="fa fa-heart"></i> {{ "PLUGIN_ADMIN.BY"|tu|lower }} <a href="http://www.rockettheme.com">RocketTheme</a>.
|
||||
</footer>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user