lp-digital/configuration-bundle

This package is abandoned and no longer maintained. No replacement package was suggested.

Useful configuration per site feature

Installs: 1 275

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 3

Forks: 1

Open Issues: 0

Type:backbee-bundle

v1.0.1 2017-06-07 09:18 UTC

This package is not auto-updated.

Last update: 2021-04-27 09:01:37 UTC


README

Build Status Code Climate Test Coverage

ConfigurationBundle provides useful configuration per site feature. This bundle support multi-sites instances.

Installation

Edit the file composer.json of your BackBee project.

Add the new dependency to the bundle in the require section:

# composer.json
...
    "require": {
        ...
        "lp-digital/configuration-bundle": "dev-master"
    },
...

Save and close the file.

Run a composer update on your project.

Activation

Edit the file repository/Config/bundles.ymlof your BackBee project.

Add the following line at the end of the file:

# bundles configuration - repository/Config/bundles.yml
...
conf: LpDigital\Bundle\ConfigurationBundle\Configuration

Save and close the file.

Then launch the command to update database:

./backbee bundle:update conf --force

Depending on your configuration, cache may need to be cleared.

Configuration

Basically, one configuration section is a collection of elements having the same syntax than BackBee parameters, see Parameters reference:

mysection:
    title: My section tite
    desc:  My section description
    elements:
        myelement:
            type: text
            label: My element label
            value: "Sample value"

Then, this configuration value will be available in templates throw the CoonfigHelper:

<div>
    {{ this.ConfigHelper('mysection:myelement') }} {# echo Sample value #}
</div>

These sections and elements will then available for editing from the Bundle panel of the administrative toolbar. There is no limit for the number of sections or the number of elements in one section.

In order to add some configuration values in your BackBee project, create and edit the file: /repository/Config/bundle/conf/sections.yml

For example, the following shows you every element types available:

#/repository/Config/bundle/conf/sections.yml
sample:
    title: Fake Section
    desc: Fake section configuration
    elements:
        text:
            type: text
            label: Example for text value
            value: ""
        password:
            type: password
            label: Example for password value
            value: ""
        datetimepicker:
            type: datetimepicker
            label: Example for datetimepicker value
            value: 0
        textarea:
            type: textarea
            label: Example for textarea value
            value: ""
        checkbox:
            type: checkbox
            label: Example for checkbox value
            options: {'fake1': 'Fake value 1', 'fake2': 'Fake value 2'}
            value: []
            inline: true
        radio:
            type: radio
            label: Example for radio value
            options: {'fake1': 'Fake value 1', 'fake2': 'Fake value 2'}
            value: []
            inline: true
        select:
            type: select
            label: Example for select value
            options: {'fake1': 'Fake value 1', 'fake2': 'Fake value 2'}
            value: []
        nodeSelector:
            type: nodeSelector
            label: Example for nodeSelector value
            value: []
        mediaSelector:
            type: mediaSelector
            label: Example for mediaSelector value
            value: []
        linkSelector:
            type: linkSelector
            label: Example for linkSelector value
            value: []

Save and close the file, optionnaly empty the cache and enjoy...

This project is supported by Lp digital

Lead Developer : @cedric-b

Released under the GPL3 License