function media_wysiwyg_schema_token in D7 Media 7.4
Basic schema for media wysiwyg tokens.
This function is knowingly named '*_schema_token' and not ending with '_schema' to avoid potential namespace conflict with hook_schema.
Parameters
$lang: The programming language this is targeted at. Either 'php' (default) or 'js'.
Return value
array Structured array with properties (array keys) the media token may consist of. Each property is an array with the following keys:
- required: (All) Whether or not this property is required in the token.
- default: (All) Default value for property.
- options: (Optional): List of allowed values for property where the key is the allowed value.
4 calls to media_wysiwyg_schema_token()
- media_wysiwyg_format_form in modules/
media_wysiwyg/ includes/ media_wysiwyg.pages.inc - Form callback for embedding media.
- media_wysiwyg_global_js_settings in modules/
media_wysiwyg/ media_wysiwyg.module - Build the global client side settings for wysiwyg editing.
- media_wysiwyg_rebuild_instance_settings in modules/
media_wysiwyg/ includes/ media_wysiwyg.upgrade.inc - Rebuild media token based on schema and allowed overridable fields.
- media_wysiwyg_validate_instance_settings in modules/
media_wysiwyg/ includes/ media_wysiwyg.filter.inc - Validate media instance settings according to token schema.
File
- modules/
media_wysiwyg/ includes/ media_wysiwyg.filter.inc, line 156 - Functions related to the WYSIWYG editor and the media input filter.
Code
function media_wysiwyg_schema_token($lang = 'php') {
$schema = array(
'type' => array(
'required' => TRUE,
'default' => 'media',
),
'fid' => array(
'required' => TRUE,
'default' => 0,
),
'view_mode' => array(
'required' => FALSE,
'default' => variable_get('media_wysiwyg_wysiwyg_default_view_mode', 'full'),
),
'alignment' => array(
'required' => FALSE,
'default' => NULL,
'options' => array(
'' => t("None"),
'left' => t("Left"),
'center' => t("Center"),
'right' => t("Right"),
),
),
'instance_fields' => array(
'required' => FALSE,
'default' => 'override',
'options' => array(
'global' => t("Global"),
'override' => t("Override"),
),
),
'attributes' => array(
'required' => FALSE,
'default' => $lang == 'js' ? new StdClass() : array(),
),
);
foreach (array(
'external_url',
'link_text',
) as $property) {
$schema[$property] = array(
'required' => FALSE,
'default' => NULL,
);
}
return $schema;
}