This class encapsulates Datamanager Schemas. It contains all information required to construct the types and widgets of a given data schema. The base class constructs out of a Datamanager 2 Schema definition, you need to use the appropriate subclass to handle them dynamically.
Schema Definition
Storage When using the Midgard storage backend, it is possible to define a callback class to be called that will then save the object. The class is defined as follows. Please note that if the classname follows the midcom hierarchy, it may be loaded automatically.
The class must satisfy the following interfaces:
class midcom_admin_parameters_callback {
// params:
// name: the name of the field
// data: the data that comes from the type defined.
// storage: a reference to the datamanager's storageclass.
function on_load_data($name,&$storage);
function on_store_data($name, $data,&$storage);
}
What the functions should return depends on the datatype they return to.
The callback may be defined in the schema like this:
'fields' => Array
(
'parameters' => Array
(
'title' => 'url name',
'storage' => Array
(
'location' => 'object',
'callback' => 'midcom_admin_parameters_callbacks_storage',
),
'type' => ..,
'widget' => ..
),
Important It is only possible to define one storage callback per schema! If you want more than one, encapsulate this in your class.
todo | Complete documentation |
---|---|
package | midcom.helper.datamanager2 |
mixed
Either the path or the already loaded schema database
to use.string
The name of the Schema to use. It must be a member in the
specified schema database. If unspecified, the default schema is used.This is callable after the construction of the object, to allow you to add additional fields like component required fields to the list.
This can also be used to merge schemas together.
It will complete the field's default and set the corresponding type and widget setups.
string
The name of the field to addarray
The fields' full configuration set.see | \midcom_helper_misc::get_snippet_content() |
---|
mixed
Either an already created raw schema array, or a midcom_helper_misc::get_snippet_content
compatible URL to a snippet / file from which the db should be loaded or schemadb contents as a string.Array
An array of midcom_helper_datamanager2_schema class instances.string
the form sessionkeyThe l10n db from the schema is used first, the Datamanager l10n db second and the MidCOM core l10n db last. If the string is not found in both databases, the string is returned unchanged.
Note, that the string is translated to lower case before translation, as this is the usual form how strings are in the l10n database. (This is for backwards compatibility mainly.)
string
The string to be translated.string
The translated string.todo | Refactor in subfunctions for better readability. |
---|
A small helper for generating link for the requested schemadb
String
String
Link tag to the loaded objectIt will automatically translate all descriptive fields according to the rules outlined in the translate_schema_field() helper function.
string
The name of the schema to load.mixed
Either the path or the already loaded schema database
to use.see | \midcom_helper_misc::get_snippet_content() |
---|
mixed
Path of the schemadb or raw schema arrayarray
Containing schemadb definitionsIts exact usage is component dependant.
It contains the full field record which has been completed with all defaults.
You may changes settings outlined here, be aware though, that types and/or widgets spawned based on this schema do normally not reference these configuration block directly, but instead they usually merge the settings made into their own internal default config. You can still adjust the types, which usually have their settings available as public members though.
This is a list of arrays. Each array defines a single callback, a field list according to HTML_QuickForm::applyFilter() along with a snippet or file location that should be auto-loaded in case the function is missing.
This is a simple array of commands, valid entries are 'save', 'cancel', 'next' and 'previous', 'edit' is forbidden, other values are not interpreted by the DM infrastructure.
This is a list of arrays. Each array defines a single callback, along with a snippet or file location that should be auto-loaded in case the function is missing.
This is a reference into the schema database.