本文整理汇总了PHP中HtmlObject\Element类的典型用法代码示例。如果您正苦于以下问题:PHP Element类的具体用法?PHP Element怎么用?PHP Element使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Element类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getItemElement
public function getItemElement()
{
$element = new Element('li');
$link = new Link($this->link, $this->value, $this->attributes);
$element->appendChild($link);
return $element;
}
示例2: getMenuItemLinkElement
public function getMenuItemLinkElement()
{
$a = new Link();
$a->setValue('');
if ($this->menuItem->getIcon()) {
$icon = new Element('i');
$icon->addClass('fa fa-' . $this->menuItem->getIcon());
$a->appendChild($icon);
}
if ($this->menuItem->getLink()) {
$a->href($this->menuItem->getLink());
}
foreach ($this->menuItem->getLinkAttributes() as $key => $value) {
$a->setAttribute($key, $value);
}
// Set styling for accessiblity options
if (Config::get('concrete.accessibility.toolbar_large_font')) {
$spacing = 'padding-top: 15px';
$height = 'line-height:17px;';
} else {
$spacing = 'padding: 16px 5px;';
$height = 'line-height:14px;';
}
$wbTitle = new Element('div');
$wbTitle->style($height . $spacing);
$wbTitle->addClass('wb-fourms')->setValue($this->menuItem->getLabel());
$a->appendChild($wbTitle);
return $a;
}
示例3: content
public static function content(ContentBlockController $controller)
{
$content = $controller->getSearchableContent();
$dom = new HtmlDomParser();
$r = $dom->str_get_html($content, true, true, DEFAULT_TARGET_CHARSET, false);
if (is_object($r)) {
foreach ($r->find('concrete-picture') as $picture) {
$fID = $picture->fid;
$fo = File::getByID($fID);
if (is_object($fo)) {
$tag = new AmpImg($fo);
$tag->alt($picture->alt);
$picture->outertext = (string) $tag;
}
}
foreach ($r->find('img') as $img) {
$tag = new Element('amp-img');
$tag->alt($img->alt);
$tag->src($img->src);
$tag->height($img->height);
$tag->width($img->width);
$img->outertext = (string) $tag;
}
foreach ($r->find('*[style]') as $element) {
$element->removeAttribute('style');
}
$content = (string) $r->restore_noise($r);
}
$content = LinkAbstractor::translateFrom($content);
return $content;
}
示例4: getColumnHtmlObjectEditMode
public function getColumnHtmlObjectEditMode()
{
$column = $this->getColumnHtmlObject();
$inner = new Element('div');
$inner->addClass('ccm-layout-column-inner ccm-layout-column-highlight');
$column->appendChild($inner);
return $column;
}
示例5: getListIconElement
public function getListIconElement()
{
$env = \Environment::get();
$type = $this->controller->getAttributeType();
$url = $env->getURL(implode('/', array(DIRNAME_ATTRIBUTES . '/' . $type->getAttributeTypeHandle() . '/' . FILENAME_BLOCK_ICON)), $type->getPackageHandle());
$img = new Element('img');
$img->addClass('ccm-attribute-icon')->src($url)->width(16)->height(16);
return $img;
}
示例6: 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;
}
示例7: 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;
}
示例8: __toString
/**
* @return string
*/
public function __toString()
{
$e = new Element('script');
$e->type('text/javascript')->src($this->getAssetURL());
if (!$this->conditional) {
return (string) $e;
} else {
return sprintf('<!--[if %s]>%s<![endif]-->', $this->conditional, (string) $e);
}
}
示例9: 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;
}
示例10: getColumnHtmlObjectEditMode
public function getColumnHtmlObjectEditMode()
{
$column = $this->getPresetColumnObject();
if ($column) {
$html = $column->getColumnHtmlObject();
$inner = new Element('div');
$inner->addClass('ccm-layout-column-inner ccm-layout-column-highlight');
$inner->setValue($this->getContents(true));
$html->appendChild($inner);
return $html;
}
}
示例11: getLayoutContainerHtmlObject
public function getLayoutContainerHtmlObject()
{
$gf = $this->layout->getThemeGridFrameworkObject();
if (is_object($gf)) {
$dom = new HtmlDomParser();
$r = $dom->str_get_html($gf->getPageThemeGridFrameworkRowStartHTML() . $gf->getPageThemeGridFrameworkRowEndHTML());
$nodes = $r->childNodes();
$node = $nodes[0];
$element = new Element($node->tag);
$element->id($node->id);
$element->class($node->class);
return $element;
}
}
示例12: testCanDynamicallyCreateObjects
public function testCanDynamicallyCreateObjects()
{
$object = Element::p('foo')->class('bar');
$matcher = $this->getMatcher();
$matcher['attributes']['class'] = 'bar';
$this->assertHTML($matcher, $object);
}
示例13: getPresetContainerHtmlObject
public function getPresetContainerHtmlObject()
{
$dom = new HtmlDomParser();
$r = $dom->str_get_html($this->arrayPreset['container']);
if (is_object($r)) {
$nodes = $r->childNodes();
$node = $nodes[0];
if (is_object($node)) {
$element = new Element($node->tag);
$element->class($node->class);
}
}
if (!isset($element)) {
$element = new Element('div');
}
return $element;
}
示例14: testGetSelectOptions
public function testGetSelectOptions()
{
$select = $this->former->select('foo')->options($this->options);
foreach ($this->options as $key => $option) {
$options[$key] = Element::create('option', $option, array('value' => $key));
}
$this->assertEquals($select->getOptions(), $options);
}
示例15: __construct
/**
* Build a new Media Object
*
* @param string $image Image URL
* @param string $title Title
* @param string $content Content
*/
public function __construct($image, $title, $content)
{
$this->addClass('media');
$image = Image::create($image);
$figure = Element::figure($image)->class('media-object');
$body = Element::div()->class('media-body');
$title = Element::h2($title)->class('media-heading');
$this->nest(array('figure' => $figure, 'body' => $body->nest(array('title' => $title, 'content' => $content))));
}