function mee_field_settings in Scald: Media Management made easy 6
Implementation of hook_field_settings().
File
- mee/
mee.module, line 60 - Defines a special textarea, with drag and drop media driven by Scald and dnd.module when rich text editing is enabled on the textarea via the WYSIWYG API.
Code
function mee_field_settings($op, $field) {
switch ($op) {
case 'form':
$form = array();
$options = array(
0 => t('Plain text'),
1 => t('Filtered text (user selects input format)'),
);
$scald_config = variable_get('scald_config', 0);
// Retrieve the context lists
$context_options = array();
$contexts_result = db_query("SELECT context, title FROM {scald_contexts} WHERE context IN ('" . implode("', '", array_keys($scald_config->contexts)) . "') ORDER BY title");
while ($context_raw = db_fetch_array($contexts_result)) {
$context_options[$context_raw['context']] = $context_raw['title'];
}
// And also retrieve the libraries defined by the enabled modules.
$libraries = dnd_get_libraries();
$form['mee_processing'] = array(
'#type' => 'radios',
'#title' => t('Text processing'),
'#default_value' => is_numeric($field['mee_processing']) ? $field['mee_processing'] : 1,
'#options' => $options,
'#description' => t('Filtered text, with a WYSIWYG editor defined on one or more input formats, is strongly recommended.'),
);
$form['mee_scald_editor_context'] = array(
'#type' => 'select',
'#title' => t('Scald Editor Context'),
'#description' => t('Choose a Scald Context to use for displaying Scald Atoms included in the textarea during editing.'),
'#default_value' => $field['mee_scald_editor_context'],
'#options' => $context_options,
);
return $form;
case 'save':
return array(
'mee_processing',
'mee_scald_editor_context',
);
case 'database columns':
$columns['value'] = array(
'type' => 'text',
'size' => 'big',
'not null' => FALSE,
'sortable' => TRUE,
);
$columns['short'] = array(
'type' => 'text',
'size' => 'big',
'not null' => FALSE,
'sortable' => TRUE,
);
if (!empty($field['mee_processing'])) {
$columns['format'] = array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => FALSE,
);
}
$columns['mee_scald_editor_context'] = array(
'type' => 'text',
'size' => 'small',
'not null' => FALSE,
);
return $columns;
case 'views data':
return content_views_field_views_data($field);
}
}