function layouter_img_caption_text_form_submit in Layouter - WYSIWYG layout templates 7
Proccess Layouter Form with two_columns_img_left_text_right.
File
- includes/
layouter.pages.inc, line 216 - File with pages callbacks.
Code
function layouter_img_caption_text_form_submit($form, &$form_state) {
$values = $form_state['values'];
$text_content = strip_tags($values['text_content']);
$image_fid = $values['image_content']['image'];
$image_style = $values['image_content']['image_style'];
$caption = strip_tags($values['image_content']['caption']);
$image_file = file_load($image_fid);
$image_file->status = FILE_STATUS_PERMANENT;
file_save($image_file);
$style_theme = $image_style == 'layouter_none' ? 'image' : 'image_style';
$image = theme($style_theme, array(
'style_name' => $image_style,
'path' => $image_file->uri,
));
$textarea_id = $form_state['textarea_id'];
// As we use the same form for different layouts we need to know which
// template to apply.
$theme = $form_state['form_info']['forms'][$form_state['step']]['theme'];
// Apply the layout to the content.
$attributes_array = array(
'text' => $text_content,
'image' => $image,
'caption' => $caption,
);
$content = theme($theme, $attributes_array);
// Insert it into textarea field.
layouter_insert_content_into_textarea($textarea_id, $content);
}