function autofloat_admin_settings_submit in AutoFloat 7.2
Submit form data.
1 string reference to 'autofloat_admin_settings_submit'
- autofloat_admin_settings in ./
autofloat.admin.inc - Implements hook_settings().
File
- ./
autofloat.admin.inc, line 265 - The admin settings for the AutoFloat module.
Code
function autofloat_admin_settings_submit($form, &$form_state) {
if (module_exists('image')) {
// Uncollapse the preview. Likely we want to see the changes we just made.
variable_set('autofloat_preview_collapsed', FALSE);
// Make sure resized default images exist.
$sample_image_medium = variable_get('image_style_preview_image', drupal_get_path('module', 'image') . '/sample.png');
$styled_file = image_style_path('medium', $sample_image_medium);
if (!file_exists($styled_file)) {
image_style_create_derivative(image_style_load('medium'), $sample_image_medium, $styled_file);
}
$sample_image_medium = '/' . variable_get('file_public_path', conf_path() . '/files') . str_replace('public:/', '', $styled_file);
$sample_image_thumb = variable_get('image_style_preview_image', drupal_get_path('module', 'image') . '/sample.png');
$styled_file = image_style_path('thumbnail', $sample_image_thumb);
if (!file_exists($styled_file)) {
image_style_create_derivative(image_style_load('thumbnail'), $sample_image_thumb, $styled_file);
}
$sample_image_thumb = '/' . variable_get('file_public_path', conf_path() . '/files') . str_replace('public:/', '', $styled_file);
// Reset to the default preview template if it is found empty.
$trimmed = trim($form_state['values']['autofloat_preview_html']['value']);
$form_state['values']['autofloat_preview_html'] = empty($trimmed) ? variable_set('autofloat_preview_html', array(
'value' => '<h3>Justified.</h3><p style="text-align: justify;"><img src="' . $sample_image_medium . '" />Lectus purus ut urna! Et velit et vel sociis mid lundium habitasse, porttitor habitasse et, proin! Et vel porttitor, parturient sagittis lorem ac. Lorem! Nisi ultricies cum diam lundium turpis enim platea. Enim proin etiam platea non a diam integer platea scelerisque? Pulvinar et dis? Sit nunc purus, tortor montes egestas. Cras magna eu? Integer dignissim. Velit turpis pellentesque arcu integer cursus aenean quis natoque! Turpis sed dolor platea, tincidunt.</p><h3>Non-justified. Image within paragraph.</h3><p>Augue lectus magna? Porttitor amet pulvinar dapibus natoque pulvinar. Tristique nec, placerat elementum pulvinar amet. Tincidunt non velit diam, placerat mus, vut pid proin hac lacus lacus cursus penatibus nisi rhoncus! <img src="' . $sample_image_thumb . '" />Tristique amet natoque mattis augue velit tortor in, cum aliquam integer proin porta habitasse vel nisi, non non duis facilisis! Integer ultricies non magna eros lacus nisi etiam! Sagittis! Ac ut quis. Tristique. Lacus aliquam mus, pulvinar dignissim. Integer, habitasse urna cursus augue, odio enim mauris porta integer risus placerat dolor, et! In, integer nunc sociis ridiculus ac egestas. Purus pulvinar, sed pulvinar, integer purus! Phasellus, enim mauris montes, mauris montes massa pellentesque vut et ut dictumst turpis natoque cum cras cras? Nunc duis aliquam enim sit egestas elementum cursus? Nisi nisi tristique turpis. Mauris placerat pid, rhoncus, tristique, nisi, placerat penatibus adipiscing elementum, placerat rhoncus est ac. Scelerisque, eu! In mauris mauris ut turpis? Porttitor nec auctor! Magna elementum porttitor. Nunc ridiculus vel nunc augue natoque placerat phasellus dignissim, scelerisque turpis.</p>',
'format' => 'full_html',
)) : $form_state['values']['autofloat_preview_html'];
}
if (module_exists('style_settings')) {
// If empty, use a space to avoid fallback to the default (.node).
$form_state['values']['autofloat_selector'] = empty($form_state['values']['autofloat_selector']) ? ' ' : $form_state['values']['autofloat_selector'];
// SELECTABLE MEASUREMENT UNIT: concatenate the value and unit in a new
// variable (the one that will be used in the CSS).
variable_set('autofloat_left', $form_state['values']['autofloat_left_value'] . $form_state['values']['autofloat_left_unit']);
variable_set('autofloat_right', $form_state['values']['autofloat_right_value'] . $form_state['values']['autofloat_right_unit']);
variable_set('autofloat_top', $form_state['values']['autofloat_top_value'] . $form_state['values']['autofloat_top_unit']);
variable_set('autofloat_bottom', $form_state['values']['autofloat_bottom_value'] . $form_state['values']['autofloat_bottom_unit']);
// Make sure changes are visible right after saving the settings.
_drupal_flush_css_js();
}
}