2017 © Pedro Peláez
 

userfrosting-sprinkle uf_configmanager

This Sprinkle provides a UI for core and custom site settings

image

lcharette/uf_configmanager

This Sprinkle provides a UI for core and custom site settings

  • Wednesday, March 7, 2018
  • by lcharette
  • Repository
  • 3 Watchers
  • 3 Stars
  • 157 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 1 Open issues
  • 7 Versions
  • 8 % Grown

The README.md

Configuration Manager Sprinkle for UserFrosting 4

Donate Latest Version ![UserFrosting Version][uf-version] Software License [Build][build] Codecov ![StyleCI][styleci-badge], (*1)

Configuration Manager sprinkle for UserFrosting 4. Lets you edit UserFrosting configs from the interface., (*2)

Help and Contributing

If you need help using this sprinkle or found any bug, feels free to open an issue or submit a pull request. You can also find me on the UserFrosting Chat most of the time for direct support., (*3)

Installation

Edit UserFrosting app/sprinkles.json file and add the following to the require list : "lcharette/uf_configmanager": "^3.0.0". Also add FormGenerator and ConfigManager to the base list. For example:, (*4)

{
    "require": {
        "lcharette/uf_configmanager": "^3.0.0"
    },
    "base": [
        "core",
        "account",
        "admin",
        "FormGenerator",
        "ConfigManager"
    ]
}

Run composer update then php bakery bake to install the sprinkle., (*5)

Permissions

The migration will automatically add the update_site_config permission to the Site Administrator role. To give access to the config UI to another user, simply add the update_site_config permission slug to that user role., (*6)

The configuration UI is bound to the the /settings route. Simply add a link to this route where you want it. The checkAccess make it so it will appear only for users having the appropriate permission. For example, you can add the following to the sidebar menu :, (*7)

{% if checkAccess('update_site_config') %}
<li>
    <a href="{{site.uri.public}}/settings"><i class="fa fa-gears fa-fw"></i> <span>{{ translate("SITE.CONFIG.MANAGER") }}</span></a>
</li>
{% endif %}

Adding custom config

Settings are separated by topics in the UI. Each topic is represented by a file, located in schema/config/. Unlike normal schema files, all entries needs to be wrapped inside a config key. A name and desc top-level entry will allow to define the title and description of the topic., (*8)

{
    "name" : "SITE.CONFIG",
    "desc" : "SITE.CONFIG.DESC",

    "config": { ... }
}

For example, to add an entry for site.title text and site.registration.enabled checkbox option in a "UserFrosting Settings" topic :, (*9)

{
    "name" : "SITE.CONFIG",
    "desc" : "SITE.CONFIG.DESC",

    "config": {
        "site.title" : {
            "validators" : {
                "required" : {
                    "message" : "SITE.TITLE.REQUIRED"
                }
            },
            "form" : {
                "type" : "text",
                "label" : "SITE.TITLE",
                "icon" : "fa-comment"
            }
        },
        "site.registration.enabled" : {
            "validators" : {},
            "form" : {
                "type" : "checkbox",
                "label" : "SITE.REGISTRATION.ENABLED"
            }
        }
    }
}

NOTE Only .json are accepted. Yaml schemas are cannot be used for now., (*10)

Licence

By Louis Charette. Copyright (c) 2020, free to use in personal and commercial software as per the MIT license., (*11)

The Versions

07/03 2018

dev-develop

dev-develop https://github.com/lcharette/UF_ConfigManager

This Sprinkle provides a UI for core and custom site settings

  Sources   Download

MIT

The Requires

 

settings config userfrosting admin panel

15/02 2018

dev-master

9999999-dev https://github.com/lcharette/UF_ConfigManager

This Sprinkle provides a UI for core and custom site settings

  Sources   Download

MIT

The Requires

 

settings config userfrosting admin panel

15/02 2018

2.0.4

2.0.4.0 https://github.com/lcharette/UF_ConfigManager

This Sprinkle provides a UI for core and custom site settings

  Sources   Download

MIT

The Requires

 

settings config userfrosting admin panel

13/02 2018

2.0.3

2.0.3.0 https://github.com/lcharette/UF_ConfigManager

This Sprinkle provides a UI for core and custom site settings

  Sources   Download

MIT

The Requires

 

settings config userfrosting admin panel

04/07 2017

2.0.2

2.0.2.0 https://github.com/lcharette/UF_ConfigManager

This Sprinkle provides a UI for core and custom site settings

  Sources   Download

MIT

The Requires

 

settings config userfrosting admin panel

03/07 2017

2.0.1

2.0.1.0 https://github.com/lcharette/UF_ConfigManager

This Sprinkle provides a UI for core and custom site settings

  Sources   Download

MIT

The Requires

 

settings config userfrosting admin panel

26/06 2017

2.0.0

2.0.0.0 https://github.com/lcharette/UF_ConfigManager

This Sprinkle provides a UI for core and custom site settings

  Sources   Download

MIT

The Requires

 

settings config userfrosting admin panel