updated existing plugin interfaces, added basket actionbar plugin interface

This commit is contained in:
Florian BLOUET
2015-08-28 16:14:07 +02:00
committed by Benoît Burnichon
parent 41d9c18c04
commit 831436f6fe
5 changed files with 61 additions and 5 deletions

View File

@@ -43,6 +43,9 @@ class PluginServiceProvider implements ServiceProviderInterface
$app['plugins.manager'] = $app->share(function (Application $app) { $app['plugins.manager'] = $app->share(function (Application $app) {
return new PluginManager($app['plugin.path'], $app['plugins.plugins-validator'], $app['conf']); return new PluginManager($app['plugin.path'], $app['plugins.plugins-validator'], $app['conf']);
}); });
$app['plugin.workzone.basket.actionbar'] = $app->share(function () {
return new Pimple();
});
$app['plugin.actionbar'] = $app->share(function () { $app['plugin.actionbar'] = $app->share(function () {
return new Pimple(); return new Pimple();
}); });
@@ -50,7 +53,7 @@ class PluginServiceProvider implements ServiceProviderInterface
return new Pimple(); return new Pimple();
}); });
$app['plugin.locale.textdomains'] = new ArrayObject(); $app['plugin.locale.textdomains'] = new \ArrayObject();
// Routes will be bound after all others // Routes will be bound after all others
// Add a new controller provider can be added as follows // Add a new controller provider can be added as follows
@@ -60,7 +63,7 @@ class PluginServiceProvider implements ServiceProviderInterface
// Routes will be bound after all others // Routes will be bound after all others
// Add a new controller provider can be added as follows // Add a new controller provider can be added as follows
// $app['plugin.controller_providers'][] = array('/prefix', 'controller_provider_service_key'); // $app['plugin.controller_providers'][] = array('/prefix', 'controller_provider_service_key');
$app['plugin.controller_providers.api'] = new ArrayObject(); $app['plugin.controller_providers.api'] = new \ArrayObject();
} }
public function boot(Application $app) public function boot(Application $app)

View File

@@ -32,10 +32,10 @@ interface ActionBarPluginInterface
/** /**
* @return string * @return string
*/ */
public function getPluginName(); public function getPluginLocale();
/** /**
* @return string * @return string
*/ */
public function getPluginLocale(); public function getPluginName();
} }

View File

@@ -0,0 +1,30 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2015 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea\Plugin;
interface BasketActionBarPluginInterface
{
/**
* @return array
*/
public function getBasketActionBar();
/**
* @return string
*/
public function getPluginLocale();
/**
* @return string
*/
public function getPluginName();
}

View File

@@ -12,4 +12,14 @@ namespace Alchemy\Phrasea\Plugin;
interface WorkZonePluginInterface interface WorkZonePluginInterface
{ {
}
/**
* @return string
*/
public function getPluginLocale();
/**
* @return string
*/
public function getPluginName();
}

View File

@@ -58,6 +58,19 @@
<img src="/skins/icons/delete.png"/> <img src="/skins/icons/delete.png"/>
</button> </button>
{% if app['plugin.workzone.basket.actionbar'].keys() is not empty %}
{% for pluginId in app['plugin.workzone.basket.actionbar'].keys() %}
{% for key,action in app['plugin.workzone.basket.actionbar'][pluginId].getBasketActionBar() %}
{% set label = action.label %}
<button class="ui-corner-all basket_window {{ action.classes|default('') }}" title="{% trans label app['plugin.workzone.basket.actionbar'][pluginId].PluginLocale %}">
<img src="{{ plugin_asset(app['plugin.workzone.basket.actionbar'][pluginId].PluginName,action.icon) }}"/>
</button>
{% endfor %}
{% endfor %}
{% endif %}
</div> </div>
<div class="alert_datas_changed ui-corner-all">{{ 'Certaines donnees du panier ont change' | trans }} <a class="basket_refresher" href="#">{{ 'rafraichir' | trans }}</a></div> <div class="alert_datas_changed ui-corner-all">{{ 'Certaines donnees du panier ont change' | trans }} <a class="basket_refresher" href="#">{{ 'rafraichir' | trans }}</a></div>
{% if basket_length == 0 %} {% if basket_length == 0 %}