getMessage()}"; } $variants = BrandButton::getVariants(); $snippetManager = PluginUtility::getSnippetManager(); $snippetManager->attachCssInternalStyleSheet("table"); $html = << Brand Name EOF; foreach ($variants as $variant) { $iconType = ucfirst($variant[BrandTag::ICON_ATTRIBUTE]); $widgetType = ucfirst($variant[TagAttributes::TYPE_KEY]); $html .= << $widgetType
$iconType EOF; } $html .= << EOF; $type = $tagAttributes->getType(); foreach ($brandNames as $brandName) { try { $brandButton = new BrandButton($brandName, $type); if (!$brandButton->getBrand()->supportButtonType($type)) { continue; } /** * Begin row */ $html .= ""; /** * First column */ $html .= "" . ucfirst($brandName) . ""; foreach ($variants as $variant) { $iconType = $variant[BrandTag::ICON_ATTRIBUTE]; $widgetType = $variant[TagAttributes::TYPE_KEY]; $brandButton ->setIconType($iconType) ->setWidget($widgetType); /** * Second column */ $html .= ""; $page = null; if ($type === BrandButton::TYPE_BUTTON_SHARE) { $page = MarkupPath::createFromRequestedPage(); } $brandTagAttributes = $brandButton->getHtmlAttributes($page); $buttonTag = $brandButton->getHtmlElement($brandTagAttributes); $html .= $brandTagAttributes->toHtmlEnterTag($buttonTag); if ($brandButton->hasIcon()) { $iconArrayAttributes = $brandButton->getIconAttributes(); $iconAttributes = TagAttributes::createFromCallStackArray($iconArrayAttributes); $name = $iconAttributes->getValueAndRemoveIfPresent(FetcherSvg::NAME_ATTRIBUTE); if ($name !== null) { $html .= Icon::createFromName($name, $iconAttributes)->toHtml(); } else { $html .= "Icon name is null for brand $brandName"; } } $snippetManager->attachCssInternalStyleSheet($brandButton->getStyleScriptIdentifier(), $brandButton->getStyle()); $html .= ""; } /** * End row */ $html .= "" . PHP_EOL; } catch (ExceptionCompile $e) { $message = "Error while rendering the brand $brandName. Error: {$e->getMessage()}"; if (!PluginUtility::isDevOrTest()) { $rowSpan = sizeof($variants) + 1; // 1 for the brand column $html .= "$message"; } else { throw new ExceptionRuntime($message, BrandListTag::MARKUP, 0, $e); } } } /** * End table */ $html .= << EOF; return $html; } }