You are here

function layouter_img_only_form_submit in Layouter - WYSIWYG layout templates 7

Proccess Layouter Form with img_only.

File

includes/layouter.pages.inc, line 155
File with pages callbacks.

Code

function layouter_img_only_form_submit($form, &$form_state) {
  $values = $form_state['values'];
  $image_fid = $values['image'];
  $image_style = $values['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'];

  // Apply the layout to the content.
  $content = theme('layouter_image_only', array(
    'image' => $image,
  ));

  // Insert it into textarea field.
  layouter_insert_content_into_textarea($textarea_id, $content);
}