/** * Renders the image tag * * @param string $src * @param array $attributes * * @return string */ protected static function _renderImage($src, $className, array $attributes = array()) { if (is_array($attributes['class'])) { $attributes['class'][] = $className; } else { $attributes['class'] .= ' ' . $className; } return sprintf('<img src="%s"%s />', Html::escape($src), Html::attributes($attributes)); }
/** * Generates a string representation of the table row * * @return string */ public function __toString() { $content = ''; foreach ($this as $cell) { $content .= $cell; } $attributes = $this->getAttributes() ?: array(); if (null !== $this->_state) { if (!isset($attributes['class'])) { $attributes['class'] = array(); } $attributes['class'][] = $this->_state; } return sprintf('<tr%s>%s</tr>', Html::attributes($attributes), $content); }
/** * Renders the table cell * * @return string */ public function __toString() { $tag = 't' . ($this->_isHeader ? 'h' : 'd'); return sprintf('<%s%s>%s</%s>', $tag, Html::attributes($this->getAttributes()), Html::escape($this->getValue()), $tag); }
/** * Renders the table element * * @return string */ public function __toString() { $attributes = $this->_attributes; if (!isset($attributes['class'])) { $attributes['class'] = array(); } if (!in_array('table', $attributes['class'])) { $attributes['class'][] = 'table'; } foreach (array('stripped', 'bordered', 'hover', 'condensed') as $attribute) { $method = 'is' . ucfirst($attribute); $className = 'table-' . $attribute; if ($this->{$method}() && !in_array($className, $attributes['class'])) { $attributes['class'][] = $className; } } $content = ''; if (null !== $this->_caption) { $content .= sprintf('<caption>%s</caption>', Html::escape($this->_caption)); } if (null !== $this->_header) { $content .= sprintf('<thead>%s</thead>', $this->_header); } $rowsAsString = ''; if (count($this->_rows)) { foreach ($this->_rows as $row) { $rowsAsString .= $row; } $content .= sprintf('<tbody>%s</tbody>', $rowsAsString); } return sprintf('<table%s>%s</table>', Html::attributes($attributes), $content); }