/** * Get the asset by ID * * @param int $id * * @return BaseAsset|null * * @throws \Exception */ public static function getAssetById($id) { $model = AssetModel::findByPk($id); if ($model === null) { throw new \Exception(sprintf('Unable to find the asset ID %s', $id)); } return static::getAssetByModel($model); }
/** * Get the editor sheets of the current theme * * @param \DataContainer $dc * * @return array */ public function getEditorSheets(\DataContainer $dc) { $assetModel = AssetModel::findByPk($dc->id); $groupModel = AssetGroupModel::findByPk($assetModel->pid); $sheetModels = \StyleSheetModel::findBy('pid', $groupModel->pid, array('order' => 'name')); if ($sheetModels === null) { return array(); } $return = array(); foreach ($sheetModels as $sheetModel) { $return[$sheetModel->id] = $sheetModel->name; } return $return; }