function retina_images_form_image_style_form_alter in Retina Images 8
Same name and namespace in other branches
- 7 retina_images.module \retina_images_form_image_style_form_alter()
Implements hook_form_FORM_ID_alter().
File
- ./
retina_images.module, line 44 - This module provides an image effect to assist in outputing high resolution images.
Code
function retina_images_form_image_style_form_alter(&$form, FormStateInterface $form_state) {
// Get the style to pass to our new theme function.
$style = $form_state
->getFormObject()
->getEntity();
// Don't show the preview on the add form.
if (isset($form['preview'])) {
// Override the preview image area to use our own preview.
// Show the thumbnail preview.
$preview_arguments = array(
'#theme' => 'retina_images_image_style_preview',
'#style' => $style,
);
$form['preview'] = array(
'#type' => 'item',
'#title' => \Drupal::translation()
->translate('Preview'),
'#markup' => drupal_render($preview_arguments),
// Render preview above parent elements.
'#weight' => -5,
);
}
}