2017 © Pedro Peláez
 

drupal-module wmsettings

Provides an Editor UI and Developers API for setting/getting content

image

wieni/wmsettings

Provides an Editor UI and Developers API for setting/getting content

  • Friday, March 30, 2018
  • by Wieni
  • Repository
  • 7 Watchers
  • 0 Stars
  • 1,092 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 2 Open issues
  • 19 Versions
  • 26 % Grown

The README.md

wmsettings

Latest Stable Version Total Downloads License, (*1)

Provides an Editor UI and Developer API for managing custom settings, (*2)

Why?

Provides an Editor UI and Developers API for setting/getting content that needs to be all over the place but isn't exactly config, and isn't exactly entity stuff., (*3)

How does it work?

Technically you create config keys (eg global or site-settings). This key gets linked directly to exactly one bundle in the settings entity type., (*4)

Developers are free to create bundles/fields in the entity type settings themselves, and create keys to refer to them., (*5)

Adding configs

On /admin/config/wmsettings one can add settings. A setting effectively links a machine name to a specific entity id. The entity gets autocreated., (*6)

You can also add configs by directly writing config files I suppose, for the brave that feel up to it. Just follow the wmsettings.schema.yml for that., (*7)

Editor UI

The administrative interface for editors is at admin/content/wmsettings. Note that:, (*8)

  • The administer wmsettings content permission + edit permissions for the settings entity type will be required to edit the settings
  • Editors should only be able to edit these autocreated entities. Do NOT provide direct access to creation/deletion of settings entitites.

Developers API

There are several ways to access the entity for a key., (*9)

1. The service.

$entity = Drupal::service('wmsettings.settings')
    ->read('my_key');

2. The module function.

wmsettings_get('my_key');

3. The fill function.

Returns a quick flattened array of all values in a setting, given field names and field types. Not a lot of field types are supported now., (*10)

$variables['copy'] = Drupal::service('wmsettings.settings')
    ->fill($global_copy, ['field_name' => 'textarea']);

Adding Tabs (local tasks) to settings for your custom routes

Drupal requires at least two tasks to show them, so for the sake of completeness this example loads two tasks too:, (*11)

wmcustom.home_controller_home.home:
    title: 'View'
    route_name: wmcustom.home_controller_home
    base_route: wmcustom.home_controller_home

wmcustom.home_controller_home.edit:
    title: 'Edit'
    route_name: wmsettings.settings.redirect
    route_parameters:
        key:  'homepage'
        anchor: 'edit-group-hero-image'
        destination: 'wmcustom.home_controller_home'
    base_route: wmcustom.home_controller_home

Changelog

All notable changes to this project will be documented in the CHANGELOG file., (*12)

Security

If you discover any security-related issues, please email security@wieni.be instead of using the issue tracker., (*13)

License

Distributed under the MIT License. See the LICENSE file for more information., (*14)

The Versions

30/03 2018

dev-master

9999999-dev

Provides an Editor UI and Developers API for setting/getting content

  Sources   Download

MIT

by Avatar Wieni

30/03 2018

0.2.3

0.2.3.0

Provides an Editor UI and Developers API for setting/getting content

  Sources   Download

MIT

by Avatar Wieni

19/06 2017

0.2.2

0.2.2.0

Provides an Editor UI and Developers API for setting/getting content

  Sources   Download

MIT

by Avatar Wieni

18/05 2017

0.2.1

0.2.1.0

Provides an Editor UI and Developers API for setting/getting content

  Sources   Download

MIT

by Avatar Wieni

27/04 2017

0.2.0

0.2.0.0

Provides an Editor UI and Developers API for setting/getting content

  Sources   Download

MIT

by Avatar Wieni

14/04 2017

0.1.9

0.1.9.0

Provides an Editor UI and Developers API for setting/getting content

  Sources   Download

MIT

by Avatar Wieni

03/03 2017

0.1.8

0.1.8.0

Provides an Editor UI and Developers API for setting/getting content

  Sources   Download

MIT

by Avatar Wieni

03/03 2017

dev-feature/wmsettings-redirect-for-tasks

dev-feature/wmsettings-redirect-for-tasks

Provides an Editor UI and Developers API for setting/getting content

  Sources   Download

MIT

by Avatar Wieni

26/01 2017

0.1.7

0.1.7.0

Provides an Editor UI and Developers API for setting/getting content

  Sources   Download

MIT

by Avatar Wieni

26/01 2017

dev-feature/better-page-name

dev-feature/better-page-name

Provides an Editor UI and Developers API for setting/getting content

  Sources   Download

MIT

by Avatar Wieni

10/01 2017

0.1.6

0.1.6.0

Provides an Editor UI and Developers API for setting/getting content

  Sources   Download

MIT

by Avatar Wieni

10/01 2017

dev-feature/switch-to-drupal-composer

dev-feature/switch-to-drupal-composer

Provides an Editor UI and Developers API for setting/getting content

  Sources   Download

MIT

by Avatar Wieni

05/12 2016

0.1.5

0.1.5.0

Provides an Editor UI and Developers API for setting/getting content

  Sources   Download

MIT

The Requires

  • drupal/eck ^8.1

 

by Avatar Wieni

30/11 2016

dev-add-fill-link-type

dev-add-fill-link-type

Provides an Editor UI and Developers API for setting/getting content

  Sources   Download

MIT

The Requires

  • drupal/eck ^8.1

 

by Avatar Wieni

30/11 2016

0.1.4

0.1.4.0

Provides an Editor UI and Developers API for setting/getting content

  Sources   Download

MIT

The Requires

  • drupal/eck ^8.1

 

by Avatar Wieni

28/11 2016

0.1.3

0.1.3.0

Provides an Editor UI and Developers API for setting/getting content

  Sources   Download

MIT

by Avatar Wieni

04/10 2016

0.1.2

0.1.2.0

Provides an Editor UI and Developers API for setting/getting content

  Sources   Download

MIT

by Avatar Wieni

30/09 2016

0.1.1

0.1.1.0

Provides an Editor UI and Developers API for setting/getting content

  Sources   Download

MIT

by Avatar Wieni

30/09 2016

0.1.0

0.1.0.0

Provides an Editor UI and Developers API for setting/getting content

  Sources   Download

MIT

by Avatar Wieni