src/Extensions/CommentsExtension.php
public function populateDefaults()
    {
        $defaults = $this->owner->config()->get('defaults');

        // Set if comments should be enabled by default
        if (isset($defaults['ProvideComments'])) {
            $this->owner->ProvideComments = $defaults['ProvideComments'];
        } else {
            $this->owner->ProvideComments = $this->owner->getCommentsOption('enabled') ? 1 : 0;
        }

        // If moderation options should be configurable via the CMS then
        if (isset($defaults['ModerationRequired'])) {
            $this->owner->ModerationRequired = $defaults['ModerationRequired'];
        } elseif ($this->owner->getCommentsOption('require_moderation')) {
            $this->owner->ModerationRequired = 'Required';
        } elseif ($this->owner->getCommentsOption('require_moderation_nonmembers')) {
            $this->owner->ModerationRequired = 'NonMembersOnly';
        } else {
            $this->owner->ModerationRequired = 'None';
        }

        // Set login required
        if (isset($defaults['CommentsRequireLogin'])) {
            $this->owner->CommentsRequireLogin = $defaults['CommentsRequireLogin'];
        } else {
            $this->owner->CommentsRequireLogin = $this->owner->getCommentsOption('require_login') ? 1 : 0;
        }
    }
public function populateDefaults()
    {
        $defaults = $this->owner->config()->get('defaults');

        // Set if comments should be enabled by default
        if (isset($defaults['ProvideComments'])) {
            $this->owner->ProvideComments = $defaults['ProvideComments'];
        } else {
            $this->owner->ProvideComments = $this->owner->getCommentsOption('enabled') ? 1 : 0;
        }

        // If moderation options should be configurable via the CMS then
        if (isset($defaults['ModerationRequired'])) {
            $this->owner->ModerationRequired = $defaults['ModerationRequired'];
        } elseif ($this->owner->getCommentsOption('require_moderation')) {
            $this->owner->ModerationRequired = 'Required';
        } elseif ($this->owner->getCommentsOption('require_moderation_nonmembers')) {
            $this->owner->ModerationRequired = 'NonMembersOnly';
        } else {
            $this->owner->ModerationRequired = 'None';
        }

        // Set login required
        if (isset($defaults['CommentsRequireLogin'])) {
            $this->owner->CommentsRequireLogin = $defaults['CommentsRequireLogin'];
        } else {
            $this->owner->CommentsRequireLogin = $this->owner->getCommentsOption('require_login') ? 1 : 0;
        }
    }
public function populateDefaults ( ) { $ defaults = $ this -> owner -> config ( ) -> get ( 'defaults' ) ; // Set if comments should be enabled by default if ( isset ( $ defaults [ 'ProvideComments' ] ) ) { $ this -> owner -> ProvideComments = $ defaults [ 'ProvideComments' ] ; } else { $ this -> owner -> ProvideComments = $ this -> owner -> getCommentsOption ( 'enabled' ) ? 1 : 0 ; } // If moderation options should be configurable via the CMS then if ( isset ( $ defaults [ 'ModerationRequired' ] ) ) { $ this -> owner -> ModerationRequired = $ defaults [ 'ModerationRequired' ] ; } elseif ( $ this -> owner -> getCommentsOption ( 'require_moderation' ) ) { $ this -> owner -> ModerationRequired = 'Required' ; } elseif ( $ this -> owner -> getCommentsOption ( 'require_moderation_nonmembers' ) ) { $ this -> owner -> ModerationRequired = 'NonMembersOnly' ; } else { $ this -> owner -> ModerationRequired = 'None' ; } // Set login required if ( isset ( $ defaults [ 'CommentsRequireLogin' ] ) ) { $ this -> owner -> CommentsRequireLogin = $ defaults [ 'CommentsRequireLogin' ] ; } else { $ this -> owner -> CommentsRequireLogin = $ this -> owner -> getCommentsOption ( 'require_login' ) ? 1 : 0 ; } }
CMS configurable options should default to the config values, but respect
default values specified by the object
CMS configurable options should default to the config values but respect default values specified by the object