m_config (zotonic_core v1.0.0-rc.14)

Model for the zotonic config table. Performs a fallback to the site configuration when a key is not defined in the configuration table.

Link to this section Summary

Functions

Return all configurations from the configuration table. Returns a nested proplist (module, key)
Delete the specified module/key combination
Get the list of configuration key for the module. Returns the empty list for non existing keys, otherwise a property list with all the module settings.
Get a configuration value for the given module/key combination.
Lookup the unique id in the config table from the module/key combination.
Fetch the value for the key from a model source
Set the value of a config iff the current value is 'undefined'. Useful for initialization of new module data schemas.
Set a "complex" config value.
Set a "simple" config value.

Link to this section Functions

-spec all(z:context()) -> list().
Return all configurations from the configuration table. Returns a nested proplist (module, key)
Link to this function

delete(Module, Key, Context)

-spec delete(atom() | binary(), atom() | binary(), z:context()) -> ok.
Delete the specified module/key combination
Link to this function

get(Module, Context)

-spec get(atom() | binary() | undefined, z:context()) -> proplists:proplist().
Get the list of configuration key for the module. Returns the empty list for non existing keys, otherwise a property list with all the module settings.
Link to this function

get(Module, Key, Context)

-spec get(atom() | binary(), atom() | binary(), z:context()) -> proplists:proplist() | undefined.
Get a configuration value for the given module/key combination.
Link to this function

get_boolean(Module, Key, Context)

-spec get_boolean(atom() | binary(), atom() | binary(), z:context()) -> boolean().
Link to this function

get_boolean(Module, Key, Default, Context)

-spec get_boolean(atom() | binary(), atom() | binary(), term(), z:context()) -> boolean().
Link to this function

get_id(Module, Key, Context)

Lookup the unique id in the config table from the module/key combination.
Link to this function

get_value(Module, Key, Context)

-spec get_value(atom() | binary(), atom() | binary(), z:context()) -> term() | undefined.
Link to this function

get_value(Module, Key, Default, Context)

-spec get_value(atom() | binary(), atom() | binary(), term(), z:context()) -> term() | undefined.
Link to this function

m_get(Rest, Msg, Context)

-spec m_get(list(), zotonic_model:opt_msg(), z:context()) -> zotonic_model:return().
Fetch the value for the key from a model source
Link to this function

set_default_value(Module, Key, Value, Context)

-spec set_default_value(atom() | binary(), atom() | binary(), string() | binary() | atom(), z:context()) ->
                     ok | {error, term()}.
Set the value of a config iff the current value is 'undefined'. Useful for initialization of new module data schemas.
Link to this function

set_prop(Module, Key, Prop, PropValue, Context)

-spec set_prop(atom() | binary(), atom() | binary(), atom() | binary(), term(), z:context()) ->
            ok | {error, term()}.
Set a "complex" config value.
Link to this function

set_value(Module, Key, Value, Context)

-spec set_value(atom() | binary(), atom() | binary(), string() | binary() | atom(), z:context()) ->
             ok | {error, term()}.
Set a "simple" config value.