本文整理汇总了PHP中HtmlObject\Element::appendChild方法的典型用法代码示例。如果您正苦于以下问题:PHP Element::appendChild方法的具体用法?PHP Element::appendChild怎么用?PHP Element::appendChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HtmlObject\Element
的用法示例。
在下文中一共展示了Element::appendChild方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getColumnValue
protected function getColumnValue()
{
$span = new Element('span');
$link = new Element('a', t('XML Element'), array('href' => '#'));
$tooltip = new Element('i', '', array('class' => 'launch-tooltip fa fa-question-circle', 'title' => t('Raw CIF XML Imported because this attribute is not installed or mapped to an existing attribute.')));
$span->appendChild($link);
$span->appendChild($tooltip);
return $span;
}
示例2: getItemElement
public function getItemElement()
{
$element = new Element('li');
$link = new Link($this->link, $this->value, $this->attributes);
$element->appendChild($link);
return $element;
}
示例3: getColumnElement
protected function getColumnElement($contents)
{
$element = new Element('div');
$element->addClass($this->getAreaLayoutColumnClass())->id('ccm-layout-column-' . $this->arLayoutColumnID);
$inner = new Element('div');
$inner->addClass('ccm-layout-column-inner');
$inner->setValue($contents);
$element->appendChild($inner);
return $element;
}
示例4: getItemElement
public function getItemElement()
{
$element = new Element('li');
$link = new Link('#', $this->getItemName());
$link->setAttribute('data-tree-action', $this->getAction());
$link->setAttribute('dialog-title', $this->getDialogTitle());
$link->setAttribute('data-tree-action-url', $this->getActionURL());
$element->appendChild($link);
return $element;
}
示例5: getMenuElement
public function getMenuElement()
{
if ($this->items->count() > $this->minItemThreshold) {
$menu = new Element('div', null, $this->menuAttributes);
$menu->addClass('popover')->addClass('fade');
$menu->appendChild((new Element('div'))->addClass('arrow'));
$inner = (new Element('div'))->addClass('popover-inner');
$list = (new Element('ul'))->addClass('dropdown-menu');
/**
* @var $item ItemInterface
*/
foreach ($this->items as $item) {
$list->appendChild($item->getItemElement());
}
$inner->appendChild($list);
$menu->appendChild($inner);
return $menu;
}
}
示例6: view
/**
* Render element view with data.
*
* @param $data
* @return string
*/
public function view($data)
{
if (array_key_exists('current', $data)) {
$this->current = $data['current'];
}
if (array_key_exists('title_formatter', $data)) {
$tf = $data['title_formatter'];
}
if (array_key_exists('descr_formatter', $data)) {
$df = $data['descr_formatter'];
}
$i = 1;
foreach ($this->steps as $step) {
$sdiv = new Element('div');
$sstyle = $this->getStyle('step');
if ($i == $this->current) {
$sdiv->addClass($this->getClass('current'));
$sstyle .= $this->getStyle('current');
} elseif ($i < $this->current) {
$sdiv->addClass($this->getClass('completed'));
$sstyle .= $this->getStyle('completed');
}
$sdiv->addClass($this->getClass('step'))->setAttribute('style', $sstyle);
$title = array_key_exists('title', $step) ? $step['title'] : '';
$descr = array_key_exists('descr', $step) ? $step['descr'] : '';
if (isset($tf) && is_callable($tf)) {
$title = $tf($title);
}
if (isset($df) && is_callable($df)) {
$descr = $df($descr);
}
$contdiv = new Element('div');
$contdiv->addClass($this->getClass('content'))->setAttribute('style', $this->getStyle('content'));
$tdiv = new Element('div', new Text($title));
$tdiv->addClass($this->getClass('title'))->setAttribute('style', $this->getStyle('title'));
$ddiv = new Element('div', new Text($descr));
$ddiv->addClass($this->getClass('descr'))->setAttribute('style', $this->getStyle('descr'));
$contdiv->appendChild($tdiv)->appendChild($ddiv);
$sdiv->appendChild($contdiv);
$this->appendChild($sdiv);
$i++;
}
return $this->render();
}
示例7: view
/**
* Render element view with data.
*
* @param $data
* @return string
*/
public function view($data)
{
//align
switch ($this->align) {
case 'center':
$a = ['text-align' => 'center'];
break;
case 'right':
$a = ['text-align' => 'right'];
break;
case 'left':
default:
$a = ['text-align' => 'left'];
}
$this->styles['list_div'] = array_merge($this->styles['list_div'], $a);
//width
$wid = floor(100 / $this->columns) - 1;
//data and formatter
$this->styles['list_item'] = array_merge($this->styles['list_item'], ['width' => "{$wid}%"]);
if (array_key_exists('data', $data)) {
$d = $data['data'];
} else {
$d = $data;
}
if (array_key_exists('label_formatter', $data)) {
$lf = $data['label_formatter'];
}
if (array_key_exists('text_formatter', $data)) {
$tf = $data['text_formatter'];
}
foreach ($d as $k => $v) {
$ltext = $k;
if (isset($lf) && is_callable($lf)) {
$ltext = $lf($k);
}
$label = new Element('label', new Text($ltext));
$label->addClass($this->getClass('list_label'))->setAttribute('style', $this->getStyle('list_label'));
$ttext = $v;
if (isset($tf) && is_callable($tf)) {
$ttext = $tf($v);
}
$text = new Element('span', new Text($ttext));
$text->addClass($this->getClass('list_text'))->setAttribute('style', $this->getStyle('list_text'));
$item = new Element('div');
$item->addClass('list_item')->setAttribute('style', $this->getStyle('list_item'));
$item->appendChild($label)->appendChild($text);
$this->appendChild($item);
$this->addClass('list_div')->setAttribute('style', $this->getStyle('list_div'));
}
return $this->render();
}