function imageeditor_imagefield_field_widget_settings_form in Image Editor 7
Configuration form for editing Image Editor settings for a field instance.
1 call to imageeditor_imagefield_field_widget_settings_form()
- imageeditor_imagefield_form_field_ui_field_edit_form_alter in imageeditor_imagefield/
imageeditor_imagefield.module - Implements hook_form_FORM_ID_alter().
File
- imageeditor_imagefield/
imageeditor_imagefield.module, line 206 - Allows online editing of image field items using different image editing services.
Code
function imageeditor_imagefield_field_widget_settings_form($instance) {
$settings = $instance['widget']['settings'];
//$settings = $instance['widget']['settings']['imageeditor'];
imageeditor_admin_css();
$form = array(
'#type' => 'fieldset',
'#title' => t('Image editor'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#weight' => 20,
'#parents' => array(
'instance',
'widget',
'settings',
),
'#theme' => 'imageeditor_imagefield_field_widget_settings_form',
);
$form['editors'] = array(
'#type' => 'item',
'#title' => t('Enabled Image Editors'),
'#description' => t('Choose enabled image editors for this field and their order.'),
);
$position = 0;
foreach (imageeditor_info('editor') as $codename => $editor) {
$position++;
$form[$codename . '_enabled'] = array(
'#type' => 'checkbox',
'#title' => theme('imageeditor_admin_item', array(
'name' => $editor['name'],
'class' => $editor['class'],
'codename' => $codename,
)) . $editor['name'] . ' (<a href="' . $editor['site'] . '" target="_blank">' . t('site') . '</a>)',
'#default_value' => isset($settings[$codename . '_enabled']) ? $settings[$codename . '_enabled'] : 0,
);
$form[$codename . '_description'] = array(
'#type' => 'markup',
'#markup' => $editor['description'],
);
$form[$codename . '_api_key'] = array(
'#type' => 'markup',
'#markup' => $editor['api_key'] ? l(variable_get($editor['api_key_codename']) ? t('Already set') : t('Required'), 'admin/config/media/imageeditor') : t('Not needed'),
);
$form[$codename . '_position'] = array(
'#type' => 'textfield',
'#default_value' => isset($settings[$codename . '_position']) ? $settings[$codename . '_position'] : $position,
'#size' => 3,
'#maxlenth' => 4,
'#attributes' => array(
'class' => array(
'imageeditor-position',
),
),
);
}
$form['uploaders'] = array(
'#type' => 'item',
'#title' => t('Enabled Upload services'),
'#description' => t('Choose enabled upload services to upload images to if your images are not available from external network.'),
);
$position = 0;
foreach (imageeditor_info('uploader') as $codename => $uploader) {
$position++;
$form[$codename . '_enabled'] = array(
'#type' => 'checkbox',
'#title' => theme('imageeditor_admin_item', array(
'name' => $uploader['name'],
'class' => $uploader['class'],
'codename' => $codename,
)) . $uploader['name'] . ' (<a href="' . $uploader['site'] . '" target="_blank">' . t('site') . '</a>)',
'#default_value' => isset($settings[$codename . '_enabled']) ? $settings[$codename . '_enabled'] : 0,
);
$form[$codename . '_description'] = array(
'#type' => 'markup',
'#markup' => $uploader['description'],
);
$form[$codename . '_api_key'] = array(
'#type' => 'markup',
'#markup' => $uploader['api_key'] ? l(variable_get($uploader['api_key_codename']) ? t('Already set') : t('Required'), 'admin/config/media/imageeditor') : t('Not needed'),
);
$form[$codename . '_position'] = array(
'#type' => 'textfield',
'#default_value' => isset($settings[$codename . '_position']) ? $settings[$codename . '_position'] : $position,
'#size' => 3,
'#maxlenth' => 4,
'#attributes' => array(
'class' => array(
'imageuploader-position',
),
),
);
}
$form['imageeditor_icons_position'] = array(
'#type' => 'radios',
'#title' => t('Icons position'),
'#description' => t('Choose icons position on the widget.'),
'#options' => array(
'top' => t('Top'),
'bottom' => t('Bottom'),
),
'#default_value' => $settings['imageeditor_icons_position'],
'#weight' => 20,
);
$form['imageeditor_replace'] = array(
'#type' => 'checkbox',
'#title' => t('Replace original images'),
'#description' => t('When editing images replace the original image with the edited one.'),
'#default_value' => $settings['imageeditor_replace'],
'#weight' => 30,
);
return $form;
}