/** * Adds some metadata to a {@link File} object that is used by the view. This function * allows us to avoid having to use a decorator on the {@link File} class. * * @param File * @return array */ protected function getFields(File $f) { if ($f instanceof Folder) { return array('Link' => $this->Link($this->getBrowseAction() . '/' . $f->ID), 'Item' => $f); } $image = $f instanceof Image; $tooltipurl = ""; if ($image) { if ($f->getHeight() > 64 || $f->getWidth() > 64) { if ($f->getOrientation() == Image::ORIENTATION_SQUARE || $f->getOrientation() == Image::ORIENTATION_LANDSCAPE) { $tooltipurl = $f->getWidth() > self::$tooltip_size ? $f->SetWidth(self::$tooltip_size)->getURL() : $f->getURL(); } else { $tooltipurl = $f->getHeight() > self::$tooltip_size ? $f->setHeight(self::$tooltip_size)->getURL() : $f->getURL(); } } } return array('Link' => '', 'Item' => $f, 'IconURL' => $image ? ($i = $f->SetHeight(64)) ? $i->getURL() : KickAssetUtil::get_icon($f) : KickAssetUtil::get_icon($f), 'Image' => $image, 'TooltipURL' => $tooltipurl); }