src/Extensions/UserPreviewPreference.php
public function updateCMSFields(FieldList $fields) {
        
        $fields->addFieldToTab('Root.Main', $field=new OptionsetField('DefaultPreviewMode', _t('UserPreviewPreference.DEFAULT_MODE', '_Default Preview Mode'), array(
                                                                                                                                                            'content'=>_t('UserPreviewPreference.CONTENT_MODE', '_Content Mode: Only menu and content areas are shown'),
                                                                                                                                                            'split'=>_t('UserPreviewPreference.SPLIT_MODE', '_Split Mode: Side by Side editing and previewing'),
                                                                                                                                                            'preview'=>_t('UserPreviewPreference.PREVIEW_MODE', '_Preview Mode: Only menu and preview areas are shown')
                                                                                                                                                        ), Config::inst()->get('UserPreviewPreference', 'DefaultMode')));
        
        if(Controller::curr()->getRequest()->getSession()->get('ShowPreviewSettingChangeReload')==true) {
            $field->setMessage(_t('UserPreviewPreference.CHANGE_REFRESH', '_You have updated your preview preference, you must refresh your browser to see the updated setting'), 'warning');
            Requirements::javascript('webbuilders-group/silverstripe-cmspreviewpreference: javascript/clear-local-preference.js');
            
            if($this->isSaving==false) {
                Controller::curr()->getRequest()->getSession()->clear('ShowPreviewSettingChangeReload');
            }
        }
    }
public function updateCMSFields(FieldList $fields) {
        
        $fields->addFieldToTab('Root.Main', $field=new OptionsetField('DefaultPreviewMode', _t('UserPreviewPreference.DEFAULT_MODE', '_Default Preview Mode'), array(
                                                                                                                                                            'content'=>_t('UserPreviewPreference.CONTENT_MODE', '_Content Mode: Only menu and content areas are shown'),
                                                                                                                                                            'split'=>_t('UserPreviewPreference.SPLIT_MODE', '_Split Mode: Side by Side editing and previewing'),
                                                                                                                                                            'preview'=>_t('UserPreviewPreference.PREVIEW_MODE', '_Preview Mode: Only menu and preview areas are shown')
                                                                                                                                                        ), Config::inst()->get('UserPreviewPreference', 'DefaultMode')));
        
        if(Controller::curr()->getRequest()->getSession()->get('ShowPreviewSettingChangeReload')==true) {
            $field->setMessage(_t('UserPreviewPreference.CHANGE_REFRESH', '_You have updated your preview preference, you must refresh your browser to see the updated setting'), 'warning');
            Requirements::javascript('webbuilders-group/silverstripe-cmspreviewpreference: javascript/clear-local-preference.js');
            
            if($this->isSaving==false) {
                Controller::curr()->getRequest()->getSession()->clear('ShowPreviewSettingChangeReload');
            }
        }
    }
public function updateCMSFields ( FieldList $ fields ) { $ fields -> addFieldToTab ( 'Root.Main' , $ field = new OptionsetField ( 'DefaultPreviewMode' , _t ( 'UserPreviewPreference.DEFAULT_MODE' , '_Default Preview Mode' ) , array ( 'content' => _t ( 'UserPreviewPreference.CONTENT_MODE' , '_Content Mode: Only menu and content areas are shown' ) , 'split' => _t ( 'UserPreviewPreference.SPLIT_MODE' , '_Split Mode: Side by Side editing and previewing' ) , 'preview' => _t ( 'UserPreviewPreference.PREVIEW_MODE' , '_Preview Mode: Only menu and preview areas are shown' ) ) , Config :: inst ( ) -> get ( 'UserPreviewPreference' , 'DefaultMode' ) ) ) ; if ( Controller :: curr ( ) -> getRequest ( ) -> getSession ( ) -> get ( 'ShowPreviewSettingChangeReload' ) == true ) { $ field -> setMessage ( _t ( 'UserPreviewPreference.CHANGE_REFRESH' , '_You have updated your preview preference, you must refresh your browser to see the updated setting' ) , 'warning' ) ; Requirements :: javascript ( 'webbuilders-group/silverstripe-cmspreviewpreference: javascript/clear-local-preference.js' ) ; if ( $ this -> isSaving == false ) { Controller :: curr ( ) -> getRequest ( ) -> getSession ( ) -> clear ( 'ShowPreviewSettingChangeReload' ) ; } } }
Updates the fields used in the cms
@param {FieldList} $fields Fields to be extended
Updates the fields used in the cms