當前位置: 首頁>>代碼示例>>PHP>>正文


PHP HtmlElement::setText方法代碼示例

本文整理匯總了PHP中HtmlElement::setText方法的典型用法代碼示例。如果您正苦於以下問題:PHP HtmlElement::setText方法的具體用法?PHP HtmlElement::setText怎麽用?PHP HtmlElement::setText使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在HtmlElement的用法示例。


在下文中一共展示了HtmlElement::setText方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: setErrorMessage

 /**
  * Set message of input error
  *
  * @param string $errorMessage
  * @return HtmlElement
  */
 public function setErrorMessage($errorMessage)
 {
     $this->_errorMessage = $errorMessage;
     if ($this->_parentLayout instanceof FormLayoutAbstract) {
         if ($errorMessage == '') {
             if ($this->_errorContainer instanceof HtmlElement) {
                 $this->_parentLayout->removeErrorContainer($this, $this->_errorContainer);
             }
             $this->_errorContainer = null;
         } else {
             if (!$this->_errorContainer instanceof HtmlElement) {
                 $this->_errorContainer = $this->_parentLayout->addErrorContainer($this, $errorMessage);
             } else {
                 $this->_errorContainer->setText($errorMessage);
             }
         }
     }
     return $this;
 }
開發者ID:2626suke,項目名稱:curryfw,代碼行數:25,代碼來源:form_element.php

示例2: addErrorContainer

 /**
  * Create and add container tag of error message to layout
  * 
  * @param FormElement $formElement
  * @param string $errorMessage
  * @return HtmlElement
  */
 public function addErrorContainer(FormElement $formElement, $errorMessage)
 {
     $errorContainer = new HtmlElement($this->_errorTagName);
     $errorContainer->setClass($this->_errorClass);
     $errorContainer->setText($errorMessage);
     $inputContainer = $formElement->getInputContainer();
     $inputContainer->addElement($errorContainer);
     return $errorContainer;
 }
開發者ID:2626suke,項目名稱:curryfw,代碼行數:16,代碼來源:form_layout_abstract.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::setText方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。