function popup_ui_form_formatters in Popup 6.x
Same name and namespace in other branches
- 8 modules/popup_ui/includes/popup_ui.admin.inc \popup_ui_form_formatters()
- 7 modules/popup_ui/includes/popup_ui.admin.inc \popup_ui_form_formatters()
- 7.x modules/popup_ui/includes/popup_ui.admin.inc \popup_ui_form_formatters()
1 string reference to 'popup_ui_form_formatters'
- popup_ui_menu in modules/
popup_ui/ popup_ui.module - Implementation of hook_menu
File
- modules/
popup_ui/ includes/ popup_ui.admin.inc, line 9
Code
function popup_ui_form_formatters() {
drupal_add_css(drupal_get_path('module', 'popup_ui') . '/popup-ui.css');
module_load_include('inc', 'popup', 'includes/popup.util');
$formatters = _popup_ui_formatter_settings();
$form = array(
'#tree' => TRUE,
);
$form['rows'] = array();
$effect_names = array_keys(array_pop(_popup_effects()));
$effect_options = array_combine($effect_names, array_map('_popup_key_to_title', $effect_names));
$style_names = array_keys(_popup_styles());
$style_options = array_combine($style_names, array_map('_popup_key_to_title', $style_names));
array_unshift($style_options, t('Default'));
$widths = range(100, 500, 50);
$options = array(
'position' => array(
'top-left' => t('Top left'),
'top-right' => t('Top right'),
'bottom-right' => t('Bottom right'),
'bottom-left' => t('Bottom left'),
),
'effect' => $effect_options,
'style' => $style_options,
'opacity' => array(
'1.0' => '1.0',
'0.9' => 0.9,
'0.8' => 0.8,
'0.7' => 0.7,
'0.6' => 0.6,
'0.5' => 0.5,
'0.4' => 0.4,
'0.3' => 0.3,
'0.2' => 0.2,
'0.1' => 0.1,
),
'width' => array_combine($widths, $widths),
);
foreach ($formatters as $label => $formatter) {
$form['rows'][$label] = _popup_ui_form_formatters_row($label, $formatter, $options);
}
$form['rows']['new'] = _popup_ui_form_formatters_row('new', array(
'origin' => 'bottom-left',
'expand' => 'bottom-right',
'effect' => 'none',
'style' => 0,
'activate' => 'hover',
), $options);
$form['buttons'] = array(
array(
'#value' => '<div class="form-item form-buttons">',
),
'submit' => array(
'#type' => 'submit',
'#value' => t('Save'),
),
array(
'#value' => popup_ui_confirm('Reset to defaults', 'Are you sure you want to reset to defaults?<br /> This action cannot be undone!', 'admin/settings/popup/formats/reset', array(
'origin' => 'top-left',
'expand' => 'top-right',
)),
),
array(
'#value' => popup_ui_confirm('Delete all', 'Are you sure you want to delete all the formats?<br /> This action cannot be undone!', 'admin/settings/popup/formats/whipe', array(
'origin' => 'top-left',
'expand' => 'top-right',
)),
),
array(
'#value' => '</div>',
),
'#weight' => 2,
);
if (!module_exists('ctools')) {
$form[] = array(
'#prefix' => '<div class="messages info">',
'#suffix' => '</div>',
'#value' => t('To enable panel display of nodes, the CTools module should be installed and enabled on the !link.', array(
'!link' => l(t('modules administration page'), 'admin/build/modules'),
)),
'#weight' => 0,
);
}
return $form;
}