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; }
public function getItemElement() { $element = new Element('li'); $link = new Link($this->link, $this->value, $this->attributes); $element->appendChild($link); return $element; }
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; }
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; }
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; } }
/** * 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(); }
/** * 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(); }