Giter Site home page Giter Site logo

setting_entities's Introduction

To create setting type enable the setting_entities_admin_ui module and clear site cache

Go to /admin/structure/settings-entity-types and add a settings type
Now go to /admin/content/setting-entities/add to add an actual settings entity

In order to use the settings within your code there are two functions:


* setting_entities_get_active_settings()
Will return an array of all active entities keyed with the settings type


* setting_entities_get_active_type_settings($type, $load = TRUE)
This will load the active settings entity instance within the given type
The type is the entity type machine name.


This module is aimed for developers who need an easy way to create and manage their settings and then provide usable interface for the client to use.

Get the setting entity with the setting_entities_get_active_type_settings() and use $entity->wrapper()->field_my_field->value(); to get the value you are interesed in. Or just use Entity API without wrappers. Learn more about entity metadata wrappers


Usage example

$setting = setting_entities_get_active_type_settings('my_custom_settings');
$my_setting_value = $setting->wrapper()->field_my_custom_setting_field->value();
print render($my_setting_value);

Note that there can only be one active entity per type. You can add more entities to the type but only one of them can be active at a time. The entity instance being currently active is configurable for client.


It provides 2 submodules - "admin ui" and "client ui". In order to add setting entity types you need to enable the admin UI submodule. The client UI submodule provides a nice interface for the end user to fill. It can be found under "Settings dashboard" menu link under "Configuration".

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.