PHP code example of jonom / silverstripe-someconfig

1. Go to this page and download the library: Download jonom/silverstripe-someconfig library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

jonom / silverstripe-someconfig example snippets


    use JonoM\SomeConfig\SomeConfig;
    use SilverStripe\ORM\DataObject;
    use SilverStripe\View\TemplateGlobalProvider;

    class EnquiryConfig extends DataObject implements TemplateGlobalProvider
    {
        use SomeConfig;

        private static $db = [
            'MailTo' => 'Varchar(255)',
            'ThankYouMessage' => 'Text',
        ];
    }
    

    use JonoM\SomeConfig\SomeConfigAdmin;
    use SilverStripe\Admin\ModelAdmin;

    class EnquiryAdmin extends ModelAdmin
    {
        use SomeConfigAdmin;

        private static $managed_models = [
            'EnquirySubmission',
            'EnquiryTopic',
            // Cannot be first
            'EnquiryConfig',
        ];

        private static $url_segment = 'enquiries';
        private static $menu_title = 'Enquiries';
        private static $menu_icon_class = 'font-icon-p-mail';
    }
    

    $email = EnquiryConfig::current_config()->MailTo