public static function getMedia($settingName) { $metaValue = (int) self::byName($settingName); $media = new MediaModel(); $media->loadByPK($metaValue); return $media->hasLoaded() ? $media : false; }
public function getMetaField(MetaModel $meta) { $field = $this->decorationFactory($meta); $field->setType('spatial'); if ($meta->getOption('spatialtype') === 'Image') { $media = new MediaModel(); $media->loadByPK($meta->getOption('media')); $field->setUseImage(true); $field->setLayerImage($this->_uploaddir . $media->get('thumbnail')); } return $field; }
public function typeBtnJson() { $value = Ajde::app()->getRequest()->getPostParam('type'); $id = Ajde::app()->getRequest()->getPostParam('id', false); $model = new MediaModel(); if (!is_array($id)) { $id = [$id]; } foreach ($id as $elm) { $model->loadByPK($elm); $model->set('mediatype', $value); $model->save(); } return ['success' => true, 'message' => Ajde_Component_String::makePlural(count($id), 'media') . ' changed']; }
public function getMediaModelFromMetaValue($metaId) { $metaValue = (int) $this->getMetaValue($metaId); $media = new MediaModel(); $media->loadByPK($metaValue); return $media->hasLoaded() ? $media : false; }