/** * @inheritDoc IElementType::getTableAttributeHtml() * * @param BaseElementModel $element * @param string $attribute * * @return string */ public function getTableAttributeHtml(BaseElementModel $element, $attribute) { // First give plugins a chance to set this $pluginAttributeHtml = craft()->plugins->callFirst('getAssetTableAttributeHtml', array($element, $attribute), true); if ($pluginAttributeHtml !== null) { return $pluginAttributeHtml; } switch ($attribute) { case 'filename': return HtmlHelper::encodeParams('<span style="word-break: break-word;">{fileName}</span>', array('fileName' => $element->filename)); case 'kind': return IOHelper::getFileKindLabel($element->kind); case 'size': if ($element->size) { return craft()->formatter->formatSize($element->size); } else { return ''; } case 'imageSize': if (($width = $element->getWidth()) && ($height = $element->getHeight())) { return "{$width} × {$height}"; } else { return ''; } case 'width': case 'height': $size = $element->{$attribute}; return $size ? $size . 'px' : ''; default: return parent::getTableAttributeHtml($element, $attribute); } }