function layouter_text_img_form_submit in Layouter - WYSIWYG layout templates 7
Proccess Layouter Form with two_columns_text_img_left.
File
- includes/
layouter.pages.inc, line 261 - File with pages callbacks.
Code
function layouter_text_img_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'];
$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.
$content = theme($theme, array(
'text' => $text_content,
'image' => $image,
));
// Insert it into textarea field.
layouter_insert_content_into_textarea($textarea_id, $content);
}