Jul 12

set custom path for october cms media manager widget

You can easily set OctoberCMS media widget path easily so next time you open media widget it will open with that specific location.

Note: its not officially supported and you can consider this as a workaround or straightforward hack.

you need to past this methods in your controller to be able to add your custom path.

Add this code to your controller.
class Movies extends Controller
{
    use BackendTraitsSessionMaker;
    // ... other code

    // this is to write session to media widget session
    public function getId($suffix = NULL) {
        return 'MediaManager-ocmediamanager';
    }

    public function create() {
        $this->putSession('media_folder', '/session-check/inner-level/');
        // put your path here -------------- ^
        return $this->asExtension('FormController')->create();
    }
}

now next time when you open october media widget from form then media widget will open folder from given location.

if you need any further assistance then please contact us.

Ad
Ad