function emthumb_emfield_widget_settings_extra in Embedded Media Field 5
Same name and namespace in other branches
- 6.3 contrib/emthumb/emthumb.module \emthumb_emfield_widget_settings_extra()
- 6 contrib/emthumb/emthumb.module \emthumb_emfield_widget_settings_extra()
- 6.2 contrib/emthumb/emthumb.module \emthumb_emfield_widget_settings_extra()
This provides extra widget settings to emfields. A checkbox to allow custom thumbnails, max resolution, image path, allow custom alt tags, allow custom title tags.
File
- contrib/
emthumb/ emthumb.module, line 176
Code
function emthumb_emfield_widget_settings_extra($op, $widget) {
switch ($op) {
case 'form':
$form = array();
$form['emthumb'] = array(
'#type' => 'fieldset',
'#title' => t('Embedded Custom Thumbnails'),
'#collapsible' => TRUE,
'#collapsed' => FALSE,
);
$form['emthumb']['emthumb'] = array(
'#type' => 'checkbox',
'#title' => t('Allow custom thumbnails for this field'),
'#description' => t('If checked, then editors may specify a custom thumbnail to be used, overriding any automatic thumbnails otherwise created.'),
'#default_value' => isset($widget['emthumb']) ? $widget['emthumb'] : 0,
);
$form['emthumb']['emthumb_label'] = array(
'#type' => 'textfield',
'#title' => t('Custom thumbnail label'),
'#default_value' => $widget['emthumb_label'] ? $widget['emthumb_label'] : t('@field custom thumbnail', array(
'@field' => $widget['label'],
)),
'#description' => t('This label will be displayed when uploading a custom thumbnail.'),
);
$form['emthumb']['emthumb_description'] = array(
'#type' => 'textfield',
'#title' => t('Custom thumbnail description'),
'#default_value' => $widget['emthumb_description'] ? $widget['emthumb_description'] : t('If you upload a custom thumbnail, then this will be displayed when the @field thumbnail is called for, overriding any automatic thumbnails by custom providers.', array(
'@field' => $widget['label'],
)),
'#description' => t('This description will be displayed when uploading a custom thumbnail.'),
'#maxlength' => 512,
);
$form['emthumb']['emthumb_max_resolution'] = array(
'#type' => 'textfield',
'#title' => t('Maximum resolution for Images'),
'#default_value' => $widget['emthumb_max_resolution'] ? $widget['emthumb_max_resolution'] : 0,
'#size' => 15,
'#maxlength' => 10,
'#description' => t('The maximum allowed custom thumbnail size expressed as WIDTHxHEIGHT (e.g. 640x480). Set to 0 for no restriction.'),
);
$form['emthumb']['emimport_image_path'] = array(
'#type' => 'textfield',
'#title' => t('Image path'),
'#default_value' => $widget['emimport_image_path'] ? $widget['emimport_image_path'] : '',
'#description' => t('Optional subdirectory within the "%dir" directory where images will be stored. Do not include trailing slash.', array(
'%dir' => variable_get('file_directory_path', 'files'),
)),
'#after_build' => array(
'emthumb_form_check_directory',
),
);
$form['emthumb']['emthumb_custom_alt'] = array(
'#type' => 'checkbox',
'#title' => t('Enable custom alternate text'),
'#default_value' => $widget['emthumb_custom_alt'] ? $widget['emthumb_custom_alt'] : 0,
'#description' => t('Enable custom alternate text for custom thumbnails. Filename will be used if not checked.'),
);
$form['emthumb']['emthumb_custom_title'] = array(
'#type' => 'checkbox',
'#title' => t('Enable custom title text'),
'#default_value' => $widget['emthumb_custom_title'] ? $widget['emthumb_custom_title'] : 0,
'#description' => t('Enable custom title text for custom thumbnails. Filename will be used if not checked.'),
);
return $form;
case 'save':
return array(
'emthumb',
'emthumb_label',
'emthumb_description',
'emthumb_max_resolution',
'emimport_image_path',
'emthumb_custom_alt',
'emthumb_custom_title',
);
}
}