You are here

function media_watermark_prepare_images in Media watermark 7

Function to prepare watermark images html.

@todo move into theme function.

Parameters

array $results: watermark images file id array

Return value

string html of watermark images

1 call to media_watermark_prepare_images()
media_watermark_form_alter in ./media_watermark.module
Implements hook_form_alter().

File

./media_watermark.module, line 266
Watermark media module.

Code

function media_watermark_prepare_images($results) {
  $output = array();

  // Build render array.
  $output['images'] = array(
    '#type' => 'container',
    '#prefix' => '<div id="edit-watermarks-images">',
    '#suffix' => '</div>',
    '#weight' => 18,
  );
  foreach ($results as $value) {
    $file = file_load($value['fid']);
    $output['images']['image-' . $value['fid']] = array(
      '#theme' => 'image_formatter',
      '#item' => array(
        'uri' => $file->uri,
        'alt' => t('Edit'),
        'title' => t('Edit'),
      ),
      '#path' => array(
        'path' => 'admin/config/media/watermark/edit/' . $value['wid'],
        'options' => array(
          'html' => TRUE,
        ),
      ),
      '#image_style' => 'media_watermark',
      '#prefix' => '<div class="image-hidden" id="image-' . $value['fid'] . '">',
      '#suffix' => '</div>',
    );
  }
  return $output;
}