本文整理汇总了PHP中Div::addAttributes方法的典型用法代码示例。如果您正苦于以下问题:PHP Div::addAttributes方法的具体用法?PHP Div::addAttributes怎么用?PHP Div::addAttributes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Div
的用法示例。
在下文中一共展示了Div::addAttributes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildPathLink
private function buildPathLink($data)
{
$links = [];
$zIndex = 10;
$pathIndex = 0;
$arrow = new Div();
$arrow->addStyleClass("path_link_item_arrow_right");
for ($index = 0; $index < count($data); $index++) {
$node = new Div();
$node->addAttributes(["xmlns:v" => "http://rdf.data-vocabulary.org/#", "typeof" => "v:Breadcrumb"]);
$node->addAttribute("style", "z-index: " . $zIndex--);
$node->addStyleClass("level" . ($index + 1));
if (count($data[$index]) > 1 && strlen(trim($data[$index][1])) > 0) {
$pathNode = new A();
$pathNode->addAttributes(["rel" => "v:url", "property" => "v:title"]);
$pathNode->addAttribute("href", $data[$index][1]);
} else {
$pathNode = new Div();
}
$trimText = Utils::trimStr($data[$index][0], Constants::DEFAULT_TEXT_LENGTH_FOR_CATALOG_PATH_LINK);
$pathNode->addChild($trimText);
$pathNode->addStyleClasses(["path_link_item_text", $index > 0 ? "not_level_first_level" : ""]);
array_push($links, $node->addChildList([$pathNode]));
}
return $links;
}
示例2: getCompactItemView
public static function getCompactItemView($name, $images, $itemId, $pageNumber, $num, $key, $valueToSearch, $type, $trimName, $isHighLightElement)
{
$blackOut = new Div();
$blackOut->addStyleClasses(["blackout", "catalog_item_button_container"]);
$blackOut->addAttributes(["itemscope" => "", "itemtype" => "http://data-vocabulary.org/Product"]);
$mainDiv = new Div();
$blackOut->addChild($mainDiv);
TagUtils::createShadow($mainDiv);
$mainDiv->addStyleClasses(["simple_item_compact", $isHighLightElement ? Constants::HIGH_LIGHT_ELEMENT : ""]);
$imagesContainer = new Div();
$imagesContainer->addStyleClass("catalog_img_container");
$mainDiv->addChild($imagesContainer);
$index = 0;
foreach ($images as $image) {
if ($index == 1) {
break;
}
$imgView = new Img();
$imgView->addAttributes(array("src" => addslashes($image), "alt" => $name, TagLabels::ON_CLICK => "openSimpleImg(arguments[0])"));
$imagesContainer->addChild($imgView);
$index++;
}
if ($type == 'HARD') {
$url = URLBuilder::getCatalogLinkForSingleItem($pageNumber, $num, $itemId, array(UrlParameters::KEY => $key, UrlParameters::SEARCH_VALUE => $valueToSearch));
$mainDiv->addStyleClass("cursor_pointer");
$link = TagUtils::createNote($trimName, "");
$blackOut->addChild($link);
$blackOut->addChild(self::getItemButton($url));
} elseif ($type == 'SIMPLE') {
$text = TagUtils::createNote($trimName, "");
$blackOut->addChild($text);
}
return $blackOut;
}