/** * This overrides the parent implementation by rendering more THiddenField-specific attributes. * @return ArrayObject the attributes to be rendered */ protected function getAttributesToRender() { $attributes = parent::getAttributesToRender(); $attributes['type'] = "hidden"; $attributes['name'] = $this->getUniqueID(); $attributes['value'] = strtr($this->getValue(), array('&' => '&', '"' => '"')); return $attributes; }
/** * This overrides the parent implementation by rendering more TWebControl-specific attributes. * @return ArrayObject the attributes to be rendered */ protected function getAttributesToRender() { $attributes = parent::getAttributesToRender(); if (!$this->isEnabled()) { $attributes['disabled'] = "disabled"; } $tabIndex = $this->getTabIndex(); if (!empty($tabIndex)) { $attributes['tabindex'] = $tabIndex; } $toolTip = $this->getToolTip(); if (strlen($toolTip)) { $attributes['title'] = $toolTip; } $accessKey = $this->getAccessKey(); if (strlen($accessKey)) { $attributes['accesskey'] = $accessKey; } $cssClass = $this->getCssClass(); if (strlen($cssClass)) { $attributes['class'] = $cssClass; } $style = $this->getStyle(); $width = $this->getWidth(); if (!empty($width)) { $style['width'] = $width; } $height = $this->getHeight(); if (!empty($height)) { $style['height'] = $height; } $foreColor = $this->getForeColor(); if (strlen($foreColor)) { $style['color'] = $foreColor; } $backColor = $this->getBackColor(); if (strlen($backColor)) { $style['background-color'] = $backColor; } $borderColor = $this->getBorderColor(); if (strlen($borderColor)) { $style['border-color'] = $borderColor; } $borderWidth = $this->getBorderWidth(); if (!empty($borderWidth)) { $style['border-width'] = $borderWidth; } $borderStyle = $this->getBorderStyle(); if (strlen($borderStyle)) { $style['border-style'] = $borderStyle; } if (count($style) > 0) { $s = ''; foreach ($style as $k => $v) { $s .= "{$k}:{$v};"; } $attributes['style'] = isset($attributes['style']) ? trim($attributes['style'], ';') . ";{$s}" : $s; } //append the javascript events $jsEvents = $this->getJavascriptEvents(); if (!empty($jsEvents) && is_array($jsEvents)) { foreach ($jsEvents as $event => $statements) { $javascripts = array(); $attribute = $this->getAttribute($event); if (!empty($attribute)) { $javascripts = explode(';', $attribute); } $javascripts = array_merge($javascripts, array_keys($statements)); $attributes[$event] = implode(';', $javascripts); } } return $attributes; }