diff --git a/lib/BridgeAbstract.php b/lib/BridgeAbstract.php
index 9629ee3d..cf8b962a 100644
--- a/lib/BridgeAbstract.php
+++ b/lib/BridgeAbstract.php
@@ -8,6 +8,7 @@ abstract class BridgeAbstract implements BridgeInterface {
const MAINTAINER = 'No maintainer';
const CACHE_TIMEOUT = 3600;
const PARAMETERS = array();
+ const FORMATS = array(); // array of compatibles formats or null
protected $cache;
protected $items = array();
diff --git a/lib/html.php b/lib/html.php
index e329102d..55591259 100644
--- a/lib/html.php
+++ b/lib/html.php
@@ -1,17 +1,37 @@
0)){
+ $bridgeFormats = $bridgeClass::FORMATS;
+ //check if format exists
+ foreach($bridgeFormats as $name){
+ if(in_array($name , $formats){
+ $compatiblesFormats[] = $name ;
+ }
+ }
+ }
+ // if no compatible format, nevermind
+ if (count($compatibles)==0){$compatiblesFormats = $formats};
+
+ $getHelperButtonsFormat = function($compatiblesFormats){
$buttons = '';
- foreach($formats as $name){
+ foreach($compatiblesFormats as $name){
$buttons .= ''
- . PHP_EOL;
+ . PHP_EOL;
}
-
return $buttons;
};
@@ -23,12 +43,6 @@ function displayBridgeCard($bridgeName, $formats, $isActive = true){
EOD;
};
- $bridgeElement = Bridge::create($bridgeName);
- $bridgeClass = $bridgeName . 'Bridge';
-
- if($bridgeElement == false)
- return "";
-
$name = '' . $bridgeClass::NAME . '';
$description = $bridgeClass::DESCRIPTION;