You are here

public function ReflectImageEffect::getForm in ImageCache Reflect 8

File

lib/Drupal/imagecache_reflect/Plugin/ImageEffect/ReflectImageEffect.php, line 73
Contains \Drupal\imagecache_reflect\Plugin\ImageEffect\ReflectImageEffect.

Class

ReflectImageEffect
Creates a reflection-like effect on an image resource.

Namespace

Drupal\imagecache_reflect\Plugin\ImageEffect

Code

public function getForm() {
  $form['bgcolor'] = array(
    '#type' => 'textfield',
    '#title' => t('Color'),
    '#description' => t('The color to use for the reflection background. Use web-style hex colors. e.g.) #FF6633. May be blank.'),
    '#default_value' => $this->configuration['bgcolor'],
    '#size' => 7,
    '#max_length' => 7,
    '#element_validate' => array(
      array(
        $this,
        'validateColor',
      ),
    ),
  );
  $form['transparency'] = array(
    '#type' => 'checkbox',
    '#title' => t('transparency source image'),
    '#default_value' => $this->configuration['transparency'],
    '#description' => t('If the image that you are reflecting uses alpha transparency, optionally use a much slower algorithm for creating the images, but one that will preserve the transparency.'),
  );
  $form['position'] = array(
    '#type' => 'radios',
    '#title' => t('Position'),
    '#default_value' => $this->configuration['position'],
    '#options' => array(
      'top' => t('Top'),
      'right' => t('Right'),
      'bottom' => t('Bottom'),
      'left' => t('Left'),
    ),
    '#description' => t('The position of the image reflection. Default is bottom.'),
    '#required' => TRUE,
  );
  $form['size'] = array(
    '#type' => 'textfield',
    '#title' => t('Size'),
    '#default_value' => $this->configuration['size'],
    '#description' => t('The size of the reflection in pixels. You may append % to the integer to represent percentages.'),
    '#required' => TRUE,
    '#element_validate' => array(
      array(
        $this,
        'validateSize',
      ),
    ),
  );
  return $form;
}