コード例 #1
0
ファイル: Image.php プロジェクト: BGCX261/zibo-svn-to-git
 /**
  * Get an attribute value from this image tag
  * @param string $attribute name of the attribute
  * @param mixed $default default value for when the attribute is not set (default null)
  * @return mixed value of the attribute if set, default value otherwise
  */
 public function getAttribute($attribute, $default = null)
 {
     if ($attribute == self::ATTRIBUTE_SRC) {
         return $this->getSource();
     }
     return parent::setAttribute($attribute, $default);
 }
コード例 #2
0
 /**
  * Sets an attribute for this element
  * @param string $attribute name of the attribute
  * @param string $value value of the attribute
  * @return null
  * @throws zibo\ZiboException when the name of attribute is empty or not a string
  */
 public function setAttribute($attribute, $value)
 {
     if ($attribute == Field::ATTRIBUTE_NAME) {
         return $this->setName($value);
     }
     if ($attribute == Field::ATTRIBUTE_VALUE) {
         return $this->setValue($value);
     }
     return parent::setAttribute($attribute, $value);
 }
コード例 #3
0
ファイル: Anchor.php プロジェクト: BGCX261/zibo-svn-to-git
 /**
  * Sets the link of this anchor element
  * @param string $href
  * @return null
  */
 public function setHref($href)
 {
     parent::setAttribute(self::ATTRIBUTE_HREF, $href);
 }
コード例 #4
0
ファイル: Form.php プロジェクト: BGCX261/zibo-svn-to-git
 /**
  * Sets a attribute to this form element
  * @param string $attribute name of the attribute
  * @param mixed $value value for the attribute
  * @return null
  */
 public function setAttribute($attribute, $value)
 {
     if ($attribute == self::ATTRIBUTE_ACTION) {
         $this->setAction($value);
         return;
     }
     if ($attribute == self::ATTRIBUTE_METHOD) {
         $this->setMethod($value);
         return;
     }
     if ($attribute == self::ATTRIBUTE_NAME) {
         $this->setName($value);
         return;
     }
     parent::setAttribute($attribute, $value);
 }