' . $name . ''; } public static function getHelperButtonsFormat($formats){ $buttons = ''; foreach( $formats as $name => $infos ) { if ( isset($infos['name']) ) { $buttons .= HTMLUtils::getHelperButtonFormat($name, $infos['name']) . PHP_EOL; } } return $buttons; } public static function displayBridgeCard($bridgeName, $formats, $isActive = true) { $bridgeElement = Bridge::create($bridgeName); if($bridgeElement == false) { return ""; } $bridgeElement->loadMetadatas(); $name = ''.$bridgeElement->name.''; $description = $bridgeElement->description; $card = <<

{$name}

{$description}

CARD; // If we don't have any parameter for the bridge, we print a generic form to load it. if(count($bridgeElement->parameters) == 0) { $card .= '
' . PHP_EOL; if ($isActive) { $card .= HTMLUtils::getHelperButtonsFormat($formats); } else { $card .= 'Inactive'; } $card .= '
' . PHP_EOL; } foreach($bridgeElement->parameters as $parameterName => $parameter) { $card .= '
    ' . PHP_EOL; if(!is_numeric($parameterName)) { $card .= '
    '.$parameterName.'
    ' . PHP_EOL; } $card .= '
    ' . PHP_EOL; $parameter = json_decode($parameter, true); foreach($parameter as $inputEntry) { if(!isset($inputEntry['exampleValue'])) $inputEntry['exampleValue'] = ""; $idArg = 'arg-' . $bridgeName . '-' . $parameterName . '-' . $inputEntry['identifier']; $card .= '' . PHP_EOL; if(!isset($inputEntry['type']) || $inputEntry['type'] == 'text') { $card .= '
    ' . PHP_EOL; } else if($inputEntry['type'] == 'number') { $card .= '
    ' . PHP_EOL; } else if($inputEntry['type'] == 'list') { $card .= '
    '; } else if($inputEntry['type'] == 'checkbox') { $card .= '
    ' . PHP_EOL; } } if ($isActive) { $card .= HTMLUtils::getHelperButtonsFormat($formats); } else { $card .= 'Inactive'; } $card .= '
    ' . PHP_EOL; } $card .= ''.$bridgeElement->maintainer.''; $card .= ''; return $card; } } ?>