本文整理汇总了PHP中HtmlObject\Element类的典型用法代码示例。如果您正苦于以下问题:PHP Element类的具体用法?PHP Element怎么用?PHP Element使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Element类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getItemElement
public function getItemElement()
{
$element = new Element('li');
$link = new Link($this->link, $this->value, $this->attributes);
$element->appendChild($link);
return $element;
}
开发者ID:ppiedaderawnet,项目名称:concrete5,代码行数:7,代码来源:LinkItem.php
示例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;
}
开发者ID:katzueno,项目名称:forums,代码行数:29,代码来源:controller.php
示例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;
}
开发者ID:hissy,项目名称:concrete5-amp,代码行数:31,代码来源:Converter.php
示例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;
}
开发者ID:digideskio,项目名称:concrete5,代码行数:8,代码来源:Column.php
示例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;
}
开发者ID:ppiedaderawnet,项目名称:concrete5,代码行数:9,代码来源:FileIconFormatter.php
示例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;
}
开发者ID:motoki1199,项目名称:addon_migration_tool,代码行数:9,代码来源:ImportedFormatter.php
示例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;
}
开发者ID:ppiedaderawnet,项目名称:concrete5,代码行数:10,代码来源:CustomColumn.php
示例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);
}
}
开发者ID:ceko,项目名称:concrete5-1,代码行数:13,代码来源:JavascriptConditionalAsset.php
示例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;
}
开发者ID:ppiedaderawnet,项目名称:concrete5,代码行数:10,代码来源:AbstractItem.php
示例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;
}
}
开发者ID:ppiedaderawnet,项目名称:concrete5,代码行数:12,代码来源:PresetColumn.php
示例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;
}
}
开发者ID:hdk0016,项目名称:concrete5-1,代码行数:14,代码来源:ThemeGridFormatter.php
示例12: testCanDynamicallyCreateObjects
public function testCanDynamicallyCreateObjects()
{
$object = Element::p('foo')->class('bar');
$matcher = $this->getMatcher();
$matcher['attributes']['class'] = 'bar';
$this->assertHTML($matcher, $object);
}
开发者ID:Geekathon,项目名称:reddit-clone,代码行数:7,代码来源:ElementTest.php
示例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;
}
开发者ID:ceko,项目名称:concrete5-1,代码行数:17,代码来源:ThemeFormatter.php
示例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);
}
开发者ID:aleguisf,项目名称:fvdev1,代码行数:8,代码来源:SelectTest.php
示例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))));
}
开发者ID:Vrian7ipx,项目名称:repocas,代码行数:16,代码来源:MediaObject.php
示例16: 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);
foreach ($node->getAllAttributes() as $key => $value) {
$element->setAttribute($key, $value);
}
}
}
if (!isset($element)) {
$element = new Element('div');
}
return $element;
}
开发者ID:ppiedaderawnet,项目名称:concrete5,代码行数:19,代码来源:ThemeFormatter.php
示例17: 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;
}
}
开发者ID:ppiedaderawnet,项目名称:concrete5,代码行数:19,代码来源:AbstractMenu.php
示例18: render
/**
* @return string
*/
public function render()
{
$label = Element::label($this->label)->for($this->id);
if ($this->inputCheckable) {
$p = Element::create($this->container)->nest(['field' => parent::render(), 'label' => $label, 'close' => '<br>']);
} else {
$p = Element::create($this->container)->nest(['label' => $label, 'field' => parent::render()]);
}
return $p->render();
}
开发者ID:potterywp,项目名称:potter,代码行数:13,代码来源:Field.php
示例19: createLabel
/**
* Create a label element from a string
*
* @param string $label
* @param string $field
*
* @return Element
*/
protected function createLabel($label, $field = null)
{
if ($label instanceof Element) {
$label = $label->getValue();
}
$label = Helpers::translate($label);
$label = Element::create('label', $label)->for($field ?: strtolower($label));
$label->addClass($this->app['former.framework']->getLabelClasses());
return $label;
}
开发者ID:dvlpp,项目名称:warkham,代码行数:18,代码来源:AbstractGroupField.php
示例20: 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);
}
$label = new Element('span');
$label->addClass('ccm-toolbar-accessibility-title')->setValue($this->menuItem->getLabel());
$a->appendChild($label);
return $a;
}
开发者ID:ceko,项目名称:concrete5-1,代码行数:20,代码来源:Controller.php
注:本文中的HtmlObject\Element类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论