You are here

function layouter_image_content in Layouter - WYSIWYG layout templates 7

Returns the form item with actual settings, to upload image.

3 calls to layouter_image_content()
layouter_img_caption_text_form in includes/layouter.pages.inc
Returns Form for adding content for two_columns_img_left_text_right layout.
layouter_img_only_form in includes/layouter.pages.inc
Returns Form for adding content for img_only layout.
layouter_text_img_form in includes/layouter.pages.inc
Returns Form for adding content for two_columns_text_img_left layout.

File

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

Code

function layouter_image_content() {
  $allowed_extensions = array(
    'png gif jpeg jpg',
  );
  $max_upload_size_mb = (int) ini_get('upload_max_filesize');
  $max_upload_size = array(
    $max_upload_size_mb * 1024 * 1024,
  );
  $image_field_description = t('Files must be less than !size.', array(
    '!size' => '<strong>' . format_size($max_upload_size[0]) . '</strong>',
  ));
  $image_field_description .= '<br />' . t('Allowed file types: !extensions.', array(
    '!extensions' => '<strong>' . $allowed_extensions[0] . '</strong>',
  ));
  $location_scheme = variable_get('layouter_uri_scheme', 'public');
  return array(
    '#type' => 'managed_file',
    '#title' => t('Image'),
    '#description' => $image_field_description,
    '#required' => 1,
    '#upload_location' => $location_scheme . '://layouter_images',
    '#upload_validators' => array(
      'file_validate_extensions' => $allowed_extensions,
      'file_validate_size' => array(
        $max_upload_size,
      ),
    ),
  );
}