本文整理汇总了PHP中Icon::create2方法的典型用法代码示例。如果您正苦于以下问题:PHP Icon::create2方法的具体用法?PHP Icon::create2怎么用?PHP Icon::create2使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Icon
的用法示例。
在下文中一共展示了Icon::create2方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($content = '', $icon = false)
{
parent::__construct($content);
if ($icon) {
$this->setIcon(is_string($icon) ? Icon::create2($icon) : $icon);
}
}
示例2: __construct
/**
* create a link for a widget
*
* @param String $label Label/content of the link
* @param String $url URL/Location of the link
* @param Mixed $icon Icon for the link, should be an Icon
* object; until v3.6 this may be a string
* @param array $attributes HTML-attributes for the a-tag in an associative array.
*/
public function __construct($label, $url, $icon = null, $attributes = array())
{
parent::__construct();
$this->label = $label;
$this->url = $url;
$this->attributes = $attributes;
// DEPRECATED
// TODO icon may be a string until v3.6
$this->icon = is_string($icon) ? Icon::create2($icon) : $icon;
}
示例3: setActiveImage
/**
* Set the image for the active state of this navigation item.
* If no active image is set, the normal image is used for the
* active state. Additional HTML attributes can be passed using
* the $options parameter (like 'style' or 'onclick').
*
* @param Icon $image an instance of class Icon depicting this item
* @param array $link_attributes additional link attributes
*/
public function setActiveImage($image, $link_attributes = [])
{
$this->active_image = $image;
$this->setLinkAttributes($link_attributes);
// DEPRECATED
// TODO remove this case in v3.6
if (is_string($image)) {
$this->active_image = Icon::create2(Assets::image_path($image));
}
}
示例4: input
/**
* Returns an input tag using options as html attributes on the
* tag, but with these special cases:
*
* * 'size' - Supplied as "X@Y", so "30@45" becomes width="30" and height="45"
*
* The source can be supplied as a...
* * full path, like "/my_images/image.gif"
* * file name, like "rss.png", that gets expanded to "/images/rss.png"
* * file name without extension, like "logo", that gets expanded to "/images/logo.png"
*
* Do not use this to render icons. Use the more appropiate class
* Icon for this.
*/
static function input($source, $opt = array())
{
if (!$source) {
return '';
}
$parts = explode('/', $source);
if (($pos = array_search('icons', $parts)) !== false) {
$source = substr($source, 6);
$source = preg_replace('/\\.png$/', '', $source);
return Icon::create2($source, $opt)->render(Icon::SVG | Icon::INPUT);
}
$size = $opt['size'];
$opt = Assets::parse_attributes($opt);
$opt['src'] = Assets::image_path($source);
$opt['type'] = 'image';
if (isset($size) && !isset($opt['width'])) {
list($opt['width'], $opt['height']) = explode('@', $size, 2);
unset($opt['size']);
}
return Assets::tag('input', $opt);
}
示例5: foreach
Sidebar::get()->insertWidget($nav_links, ':first');
}
}
}
// TODO: Remove this after sidebar migration has been completed
if ($infobox && is_array($infobox)) {
$sidebar = Sidebar::get();
if (!$sidebar->getImage()) {
$sidebar->setImage(is_object($infobox['picture']) ? $infobox['picture']->getURL(Avatar::NORMAL) : $infobox['picture']);
}
foreach ($infobox['content'] as $entry) {
$widget = new InfoboxWidget();
$widget->setTitle($entry['kategorie']);
if (isset($entry['eintrag']) && is_array($entry['eintrag'])) {
foreach (@$entry['eintrag'] as $row) {
$icon = is_string($row['icon']) ? Icon::create2(str_replace('/black/', '/blue/', $row['icon'])) : $row['icon'];
$widget->addElement(new InfoboxElement($row['text'], $icon));
}
}
$sidebar->addWidget($widget);
}
unset($infobox);
}
?>
<!DOCTYPE html>
<html class="no-js">
<head>
<meta charset="WINDOWS-1252">
<title>
<?php
echo htmlReady(PageLayout::getTitle() . ' - ' . $GLOBALS['UNI_NAME_CLEAN']);
示例6: if
<tr>
<td colspan="2">
<b><?php
echo $category["kategorie"];
?>
</b>
</td>
</tr>
<? if (isset($category['eintrag'])) : ?>
<? foreach ($category['eintrag'] as $item) : ?>
<tr>
<td width="1%" align="center" valign="top">
<?php
echo is_string($item['icon']) ? Icon::create2($item['icon'])->asImg() : $item['icon']->asImg();
?>
</td>
<td width="99%">
<?php
echo $item["text"];
?>
</td>
</tr>
<? endforeach ?>
<? endif ?>
<? endforeach ?>
</table>