Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

All other Modules /

Discuss all other Modules here.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Default simplify configuration

Go to End

3 Posts   1130 Views


Community Member, 150 Posts

15 October 2010 at 6:53am


Great module you've created! One question though: I have set up all simplify permissions for a group, and would like to reuse this simplify config for other sites as well. is it possible to define a default simplify config in e.g. _config.php?


Community Member, 10 Posts

19 October 2010 at 4:36pm

You can create a simple setup module to create the necessary simplify permissions when you are setting up the site.



Director::addRules(100, array(
        'admin/setup/$Action/$ID' => 'SetupCMS',



class SetupCMS extends Controller {

    static $url_segment = 'simplify';

    static $allowed_actions = array(

    function simplify() {
        if (!Member::currentUser()->isAdmin()) {
            return Security::permissionFailure($this);

        // GroupID => Code
        $general_permissions = array(
            1 => array(

        // GroupID => array(HidePage, HideName, HideType)
        $page_permissions = array(
            1 => array(
                array('Page', 'Behaviour', 'Tab'),
                array('Page', 'Access', 'Tab'),
                array('BlogEntry', 'Behaviour', 'Tab'),
                array('BlogEntry', 'Access', 'Tab'),

        foreach ($general_permissions as $groupID => $codes) {
            foreach ($codes as $code) {
                $perm = DataObject::get_one("Permission", "Code='{$code}' AND GroupID={$groupID}");
                if (!$perm) {
                    Permission::grant($groupID, $code);

        foreach ($page_permissions as $groupID => $permissions) {
            foreach ($permissions as $permission) {
                $perm = SimplifyPermission::checkField($permission[0], $permission[1], $permission[2], $groupID);
                if (!$perm) {
                    $perm = new SimplifyPermission;
                    $perm->HidePage = $permission[0];
                    $perm->HideName = $permission[1];
                    $perm->HideType = $permission[2];
                    $perm->GroupID = $groupID;

        echo "Simplify settings updated. Simplify rocks!";


After that, just access the url /admin/setup/simplify

For a list of simplify permission in the $general_permissions array, you can refer to simplify/code/SimplifyPermissionProvider.php
For a list of simplify permission in the $page_permissions array, you will need to refer to the "Field Tree" after you click on the "Load Field Tree" button in the Simplify interface.


Community Member, 150 Posts

19 October 2010 at 8:43pm