mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2025-11-04 20:36:03 +01:00
Moved plugins in admin to new GPM
This commit is contained in:
@@ -9,6 +9,7 @@ use Grav\Common\Uri;
|
||||
use Grav\Common\Page\Pages;
|
||||
use Grav\Common\Page\Page;
|
||||
use Grav\Common\Data;
|
||||
use Grav\Common\GPM\Local\Packages as LocalPackages;
|
||||
use RocketTheme\Toolbox\File\File;
|
||||
use RocketTheme\Toolbox\File\LogFile;
|
||||
use RocketTheme\Toolbox\File\YamlFile;
|
||||
@@ -63,6 +64,11 @@ class Admin
|
||||
*/
|
||||
public $user;
|
||||
|
||||
/**
|
||||
* @var Packages
|
||||
*/
|
||||
public $localPackages;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
@@ -282,9 +288,15 @@ class Admin
|
||||
*/
|
||||
public function themes()
|
||||
{
|
||||
if (!$this->localPackages) {
|
||||
$this->localPackages = new LocalPackages();
|
||||
}
|
||||
|
||||
return $this->localPackages['themes']->toArray();
|
||||
|
||||
/** @var Themes $themes */
|
||||
$themes = $this->grav['themes'];
|
||||
return $themes->all();
|
||||
/*$themes = $this->grav['themes'];
|
||||
return $themes->all();*/
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -306,9 +318,15 @@ class Admin
|
||||
*/
|
||||
public function plugins()
|
||||
{
|
||||
if (!$this->localPackages) {
|
||||
$this->localPackages = new LocalPackages();
|
||||
}
|
||||
|
||||
return $this->localPackages['plugins'];
|
||||
|
||||
/** @var Plugins $plugins */
|
||||
$plugins = $this->grav['plugins'];
|
||||
return $plugins->all();
|
||||
/*$plugins = $this->grav['plugins'];
|
||||
return $plugins->all();*/
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -437,5 +455,4 @@ class Admin
|
||||
{
|
||||
return dirname('/' . Grav::instance()['admin']->route);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -12,18 +12,19 @@
|
||||
{% include 'partials/messages.html.twig' %}
|
||||
|
||||
<table>
|
||||
{% for plugin in admin.plugins %}
|
||||
{% set blueprints = plugin.blueprints() %}
|
||||
{% for slug, package in admin.plugins %}
|
||||
{% set plugin = package.toArray() %}
|
||||
{% set data = package.getData() %}
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<a href="{{ base_url_relative }}/plugins/{{ blueprints.name|url_encode }}">{{ blueprints.get('name') }}</a>
|
||||
<a href="{{ base_url_relative }}/plugins/{{ slug|url_encode }}">{{ plugin.name }}</a>
|
||||
</td>
|
||||
<td>
|
||||
<form action="{{ base_url_relative }}/plugins/{{ blueprints.name }}" method="post">
|
||||
<form action="{{ base_url_relative }}/plugins/{{ slug }}" method="post">
|
||||
<input type="hidden" name="enabled" value="{{ plugin.get('enabled') ? 0 : 1 }}" />
|
||||
<input type="hidden" name="_redirect" value="plugins" />
|
||||
<button class="button" name="task" value="enable"{{ blueprints.name == 'admin' ? ' disabled="disabled"' }}>
|
||||
<button class="button" name="task" value="enable"{{ slug == 'admin' ? ' disabled="disabled"' }}>
|
||||
{{ plugin.get('enabled') ? 'Enabled' : 'Disabled' }}
|
||||
</button>
|
||||
</form>
|
||||
@@ -32,18 +33,24 @@
|
||||
{% endfor %}
|
||||
</table>
|
||||
{% else %}
|
||||
{% set plugin = admin.plugins[admin.route] %}
|
||||
{% set blueprints = plugin.blueprints() %}
|
||||
{% set package = admin.plugins[admin.route] %}
|
||||
{% set plugin = package.toArray() %}
|
||||
|
||||
|
||||
<h1>
|
||||
{{ blueprints.get('name')|e }}
|
||||
<small>{{ blueprints.get('version') ? 'v' ~ blueprints.get('version')|e }}</small>
|
||||
{{ plugin.name|e }}
|
||||
<small>{{ plugin.version ? 'v' ~ plugin.version|e }}</small>
|
||||
{{ dump(plugin) }}
|
||||
<small>{{ plugin.icon }}</small>
|
||||
<small>{{ plugin.homepage }}</small>
|
||||
<small>{{ plugin.author.name }}</small>
|
||||
<small>{{ plugin.author.email }}</small>
|
||||
</h1>
|
||||
|
||||
{% include 'partials/messages.html.twig' %}
|
||||
<p>{{ blueprints.get('description') }}</p>
|
||||
<p>{{ plugin.description }}</p>
|
||||
|
||||
{% include 'partials/blueprints.html.twig' with { data: plugin } %}
|
||||
{% include 'partials/blueprints.html.twig' with { data: plugin.form, blueprints: plugin.form } %}
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user