You are here

function panels_image_edit in Image 5.2

Returns an edit form for the custom type.

1 call to panels_image_edit()
panels_image_add in content_types/image.inc
Returns the form for a new image.
1 string reference to 'panels_image_edit'
image_image_panels_content_types in content_types/image.inc
Callback function to supply a list of content types.

File

content_types/image.inc, line 94

Code

function panels_image_edit($id, $parents, $conf) {
  $form['nid'] = array(
    '#type' => 'value',
    '#default_value' => $conf['nid'],
  );
  if (function_exists('image_get_sizes')) {
    foreach (image_get_sizes() as $key => $size) {
      $dimensions = $size['width'] . 'x' . $size['height'];
      $label = $size['label'];
      if ($dimensions != 'x') {
        $label .= ' ' . $dimensions;
      }
      $image_sizes[$key] = $label;
    }
    $form['image_size'] = array(
      '#type' => 'select',
      '#title' => t('Image size'),
      '#options' => $image_sizes,
      '#description' => t('What size of the image should be inserted?'),
    );
    if (isset($conf['image_size'])) {
      $form['image_size']['#default_value'] = $conf['image_size'];
    }
  }
  $form['caption_type'] = array(
    '#type' => 'select',
    '#title' => t('Image caption'),
    '#options' => array(
      'none' => t('None'),
      'body' => t('Existing caption'),
      'custom' => t('Custom caption'),
    ),
    '#default_value' => isset($conf['caption_type']) ? $conf['caption_type'] : 'none',
    '#description' => t('Which caption (if any) should be displayed?'),
  );
  $form['caption_text'] = array(
    '#type' => 'textfield',
    '#title' => t('Custom caption'),
    '#default_value' => isset($conf['caption_text']) ? $conf['caption_text'] : '',
  );
  return $form;
}