function picture_ckeditor_settings in Picture 7
Chooses which picture groups are available in the CKEditor image dialog.
1 string reference to 'picture_ckeditor_settings'
- picture_menu in ./
picture.module - Implements hook_menu().
File
- ./
picture.admin.inc, line 291 - Picture - map breakpoints and image styles
Code
function picture_ckeditor_settings() {
$form = array();
$picture_groups = picture_get_mapping_options();
$ckeditor_groups = array();
// Check if picture group mappings have been configured before proceeding.
if ($picture_groups) {
// Create a settings form.
$form['description'] = array(
'#type' => 'item',
'#title' => t('Choose which picture groups will be available in the CKEditor image dialog.'),
'#description' => 'See picture_wysiwyg.css for an example of how to style these images in your theme using the selectors suggested below.',
);
// Retrieve pre-existing settings.
$ckeditor_groups = variable_get('picture_ckeditor_groups', array());
// Loop through each picture group and place a checkbox and weight.
foreach ($picture_groups as $machine_name => $display_name) {
$form[$machine_name] = array(
'#type' => 'fieldset',
'#title' => t('@name picture group', array(
'@name' => $display_name,
)),
);
$form[$machine_name]['enabled'] = array(
'#type' => 'checkbox',
'#default_value' => isset($ckeditor_groups[$machine_name]) ? $ckeditor_groups[$machine_name]['enabled'] : 0,
'#title' => t('Include @name picture group in the CKEditor image dialog', array(
'@name' => $display_name,
)),
);
$form[$machine_name]['css'] = array(
'#type' => 'item',
'#markup' => 'Consider using the selector <code>span[data-picture-group="' . $machine_name . '"]</code> in your theme CSS.',
);
$form[$machine_name]['weight'] = array(
'#type' => 'select',
'#title' => t('Weight'),
'#options' => drupal_map_assoc(array(
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
)),
'#default_value' => isset($ckeditor_groups[$machine_name]) ? $ckeditor_groups[$machine_name]['weight'] : 1,
'#description' => t('Control the sort order of picture groups in the CKEditor "size" drop-down. Higher weights sink to the bottom of the list.'),
);
$form[$machine_name]['fallback'] = array(
'#type' => 'select',
'#title' => t('Fallback image style'),
'#options' => drupal_map_assoc(array_keys(image_styles())),
'#default_value' => isset($ckeditor_groups[$machine_name]) ? $ckeditor_groups[$machine_name]['fallback'] : NULL,
);
}
$form['#tree'] = TRUE;
$form['ckeditor_label'] = array(
'#type' => 'textfield',
'#title' => t('Label in the CKEditor image dialog'),
'#description' => t('This sets the label for the drop-down select box containing these picture groups in the CKEditor image dialog'),
'#default_value' => variable_get('picture_ckeditor_label', 'Image size (required)'),
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => 'Save',
);
}
return $form;
}