Configure Default Values in October CMS Backend Settings Model

Posted in October CMS on Oct 23, 2019 by Zach Schneider

I just spent way too long Googling for something that I know I've done before, so here's a note for future me. I'm often developing October CMS plugins for side projects and the current documentation isn't quite complete yet, which occasionally leaves me hunting for some obscure details. To initialize default values for a plugin's backend settings model, use the initSettingsData() method as shown:

<?php

namespace Zaxbux\Plugin\Models;

use Model;

class Settings extends Model {

    // ...

    public function initSettingsData() {
        $this->someProperty = 'some value';
    }

    // ...

}