initLocale(); } /** * @inheritDoc */ public function render() { $this->actAsParent(); $parentContent = parent::render(); $this->actAsParent(false); if (!$this->isAvailable) { return $parentContent; } $this->vars['mediafinder'] = $parentContent; return $this->makePartial('mlmediafinder'); } /** * Prepares the form widget view data */ public function prepareVars() { parent::prepareVars(); $this->prepareLocaleVars(); // make root path of media files accessible $this->vars['mediaPath'] = $this->mediaPath = MediaLibrary::url('/'); } /** * @inheritDoc */ public function getSaveValue($value) { return $this->getLocaleSaveValue($value); } /** * @inheritDoc */ public function loadAssets() { $this->actAsParent(); parent::loadAssets(); $this->actAsParent(false); if (Locale::isAvailable()) { $this->loadLocaleAssets(); $this->addJs('js/mlmediafinder.js'); $this->addCss('css/mlmediafinder.css'); } } /** * {@inheritDoc} */ protected function getParentViewPath() { return base_path().'/modules/backend/formwidgets/mediafinder/partials'; } /** * {@inheritDoc} */ protected function getParentAssetPath() { return '/modules/backend/formwidgets/mediafinder/assets'; } }