/** * Get asset data (used in template) * @param array $thumbOptions * @return array * * The associative array data returned has the keys: * categoryName => Human readable title, e.g. "Soul Bubbles Nintendo DS" * displayTitle => Preferred title entered via Admin tool, e.g. "Soul Bubbles on Nintendo DS" * thumbnails => An array of video thumbnail data of the format: * [ title => $title, * thumb => $thumb, * url => $url, * ] * updatedBy => Name of the user who updated this asset last * updatedAt => Date this asset was last updated, e.g. "17:04, September 13, 2013" */ public function getAssetData($thumbOptions = array()) { $title = Title::newFromText($this->categoryName, NS_CATEGORY); if (empty($title)) { return self::getDefaultAssetData(); } // Allow defaults to be overridden by options passed into us $thumbOptions = array_merge($this->defaultThumbOptions, $thumbOptions); $helper = new VideoPageToolHelper(); $data = array('categoryName' => $title->getText(), 'displayTitle' => $this->displayTitle, 'thumbnails' => $helper->getVideosByCategory($title, $thumbOptions), 'total' => $helper->getVideosByCategoryCount($title), 'url' => $title->escapeLocalURL(), 'seeMoreLabel' => wfMessage('videopagetool-see-more-label')->plain()); $assetData = array_merge($data, parent::getAssetData($thumbOptions)); return $assetData; }
/** * Get asset data (used in template) * @param array $thumbOptions An optional array of options to pass to the thumbnailer * @return array An associative array of video metadata for the video named by $this->title * * The associative array data returned has the keys: * videoTitle => Human readable title, e.g. "Soul Bubbles Nintendo DS Trailer - Bubbles" * videoKey => DBKey of the title, e.g. "Soul_Bubbles_Nintendo_DS_Trailer_-_Bubbles" * displayTitle => Preferred title entered via Admin tool, e.g. "Bubbles from "Soul Bubbles" on Nintendo DS" * videoThumb => Embed code for the video thumbnail. * largeThumbUrl => Large version of the video thumbnail image. Does not include the embed code. * altThumbName => Human readable title of the thumbnail that will replace original thumbnail * altThumbKey => DBKey of the thumbnail that will replace original thumbnail * description => Description of this video given in the Admin tool, e.g. "All about Bubbles!" * videoTitleClass => * altThumbClass => * updatedBy => User who updated this asset last, e.g. "Garthwebb" * updatedAt => Date this asset was last updated, e.g. "17:04, September 13, 2013" */ public function getAssetData($thumbOptions = array()) { // Allow defaults to be overridden by options passed into us $thumbOptions = array_merge($this::$defaultThumbOptions, $thumbOptions); $helper = new VideoPageToolHelper(); $data = $helper->getVideoData($this->title, $this->altThumbTitle, $this->displayTitle, $this->description, $thumbOptions); if (empty($data)) { return self::getDefaultAssetData(); } // This needs to be set to an empty string when there is a real asset rather than default asset data $data['videoTitleClass'] = ''; $data['altThumbClass'] = ''; $assetData = array_merge($data, parent::getAssetData()); return $assetData; }