当前位置: 首页>>代码示例>>PHP>>正文


PHP HtmlElement::setAttributes方法代码示例

本文整理汇总了PHP中HtmlElement::setAttributes方法的典型用法代码示例。如果您正苦于以下问题:PHP HtmlElement::setAttributes方法的具体用法?PHP HtmlElement::setAttributes怎么用?PHP HtmlElement::setAttributes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HtmlElement的用法示例。


在下文中一共展示了HtmlElement::setAttributes方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setLabel

 function setLabel($label_text, $attributes = array())
 {
     $label = new HtmlElement('label', null, true);
     $label->setAttribute('class', 'phaxsi_label');
     $label->setAttributes($attributes);
     $label->innerHTML = $label_text;
     $this->label = $label;
 }
开发者ID:RNKushwaha022,项目名称:orange-php,代码行数:8,代码来源:textlist.input.php

示例2: addCell

 /**
  * Add cell by specifying column key and value
  * 
  * @param string $columnKey
  * @param string|HtmlElement $value
  * @return HtmlElement
  * @throws Exception
  */
 public function addCell($columnKey, $value = null)
 {
     if ($this->existsCell($columnKey)) {
         throw new Exception('cell "' . $columnKey . '" already exists.');
     }
     $cell = new HtmlElement($this->_cellTagName);
     $cell->setIsReturnInner(false);
     $attrs = $this->_parentTable->getColumnAttributes($columnKey);
     if ($attrs) {
         $cell->setAttributes($attrs);
     }
     if ($value !== null) {
         $nodes = $value;
         if (!is_array($value)) {
             $nodes = array($value);
         }
         $cell->addNodes($nodes);
     }
     $this->_addCellElement($columnKey, $cell);
     return $cell;
 }
开发者ID:2626suke,项目名称:curryfw,代码行数:29,代码来源:html_table_row.php

示例3: _createElement

 /**
  * Create element by tag setting array
  * 
  * @param array $setting
  * @return HtmlElement
  */
 protected static function _createElement($setting)
 {
     if (!isset($setting['tag_name'])) {
         throw new Exception('Specification of "tag_name" is required, but not specified.');
     }
     $elem = new HtmlElement($setting['tag_name']);
     if (isset($setting['attributes'])) {
         if (!is_array($setting['attributes'])) {
             throw new Exception('Specification of "attributes" in element setting must be an array, ' . gettype($setting['attributes']) . ' given.');
         }
         $elem->setAttributes($setting['attributes']);
     }
     if (isset($setting['is_empty'])) {
         $elem->setIsEmptyTag($setting['is_empty']);
     }
     if (isset($setting['nodes'])) {
         if ($elem->isEmptyTag()) {
             throw new Exception('Empty tag cannot contain node.');
         }
         if (!is_array($setting['nodes'])) {
             throw new Exception('Specification of "nodes" in element setting must be an array, ' . gettype($setting['nodes']) . ' given.');
         }
         foreach ($setting['nodes'] as $node) {
             if (is_array($node)) {
                 $subElem = self::_createElement($node);
                 $elem->addElement($subElem);
             } else {
                 $elem->addText($node);
             }
         }
     }
     if (isset($setting['text'])) {
         if ($elem->isEmptyTag()) {
             throw new Exception('Empty tag cannot contain node.');
         }
         if (is_array($setting['text']) || is_object($setting['text'])) {
             throw new Exception('Specification of "text" in element setting must be string, ' . gettype($setting['text']) . ' given.');
         }
         $elem->setText($setting['text']);
     }
     return $elem;
 }
开发者ID:2626suke,项目名称:curryfw,代码行数:48,代码来源:html_element.php


注:本文中的HtmlElement::setAttributes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。