Config Pages | Drupal 8 Project | Drupal 8

Config Pages | Drupal 8 Project


Project Name : Config Pages
Drupal.org project Link : Config Pages
Created : 2015-09-15
Last Update : 2017-10-19
Current Version : 8.x-2.1
Download Config Pages 8.x-2.1 Version From Drupal.org : Download

DO I NEED IT?
At some point i was tired of creating custom pages using menu and form api, writing tons of code just to have a page with ugly form where client can enter some settings, and as soon as client wants to add some interactions to the page (drag&drop, ajax etc) things starts to get hairy. Same story was with creation of dedicated CT just to theme a single page (like homepage) and explaining why you can only have 1 node of this type, or force it programmatically.

If this sounds familiar, then this module may be just a thing you were looking for :)

DESCRIPTION:
This module provide fieldable entity that allows to create customizable feature-rich configuration pages and place them where you like in menu system, you are able to use fieldAPI with fine widgets created by community, so multi-values drag&drop, autocomplete, file uploads looks pretty and just works out of the box!

MAIN FEATURES:
Fieldable entity (config page)
Create fieldable entity using BO. FieldAPI, Features, views and other entity related modules are supported.

Mount your config page into menu structure as you like
Your can choose how (where) user will access this config page, so it can have proper path like "admin/config/mysettings" and not explain customer that he needs to create "a special node" in node/add.

Context-awareness
You need to have same page with different settings based on current language or domain or some other factor? Config pages controller will automatically load proper config page based on current context. You can copy settings from one context to another, import and export text values using Features. Language and Domain (Domain module) contexts are supplied with this module, but you can add your custom context in no time using module's API.

Create "singleton" pages
You no longer need to create a new content type that will store fields for your singleton pages like homepage and explain to client that this page is a content but he can't create 2 nodes in it.

Themable
Config pages are themable as any other entity, so with proper view mode configuration you can just drop CCT provided by this module on the Page (in Panel module) and have your config page rendered.

Nodequeue replacement
In most cases, using config pages will give you more flexibility than nodequeue module. Just you use EntityReference field, and use views as autocomplete source, so you have all the power of views at your hands. And it will have all the features above - context awareness, themable and more.

NEW in 7.x-1.4

Context switching links
API to provide context switching links along with context definition, example for language context included (see last screenshot).

Panelizer support
If you need to have "different" pages for some context (language for example) but with same Drupal path then you can't use nodes and using panels with several variants will require client to manage panels (which isn't good either). This is where this module steps in, with Panelizer and IPE support.

DEPENDENCIES:
This module depends on "Entity API" (https://www.drupal.org/project/entity) module.

INSTALLATION:
Install this module as any other module.

CREATING CONFIG PAGE:

  1. After module installed, you can navigate to "admin/config/development/config_pages_types" and click on "Add config page".
  2. Enter config page title and mount point, for example "admin/config/mysettings" and menu item type.
  3. Choose context if you need (if for example you want to have different settings for different languages) and save config page.
  4. Go to "admin/config/development/config_pages_types" and find your config page there, you can add desired fields as you do for any other entity.
  5. If this config page is expected to be rendered (for exmaple if this is homepage config) manage display for your config page as you do for any other entity.
  6. At this point you can find you page using the path from pt2. (admin/config/mysettings).
  7. Give appropriate user roles access to config page you created (using permissions).

HOW CAN I ACCESS MY SETTINGS?

  • If this config page is used to store settings then you should use config_pages_get() or config_pages_config() functions.
  • If this config page is singleton page like custom homepage, you can use config_pages_render(), config_pages_render_field() to use in your code, or CTools Content Type called "Config Pages: Content" to place on panels.

I WANT MORE!

  • Saving your config pages to features is essential to make them part of site code.
  • Saving config pages values to features is possible but not always useful.
  • If you need different configurations based on some custom context - create one using provided contexts as example!

CREDITS:
This module takes it roots from the "Model Entities" module (https://www.drupal.org/project/model). An excellent guide and starting point to create your custom entity.