You are here

public function ImageAPIOptimizeProcessorKraken::configForm in Image Optimize (or ImageAPI Optimize) 7.2

Overrides ImageAPIOptimizeProcessorConfigurableInterface::configForm

File

modules/kraken/plugins/ImageAPIOptimizeProcessorKraken.inc, line 32

Class

ImageAPIOptimizeProcessorKraken

Code

public function configForm() {
  if (!$this
    ->libraryPresent()) {
    $form['library'] = array(
      '#type' => 'markup',
      '#markup' => t('Kraken.io integration requires the
        <a href="">Kraken-PHP library</a> to be installed in your libraries folder as kraken-php (sites/all/libraries/kraken-php).', array(
        '!kraken-lib' => l(t('Kraken-PHP library'), 'https://github.com/kraken-io/kraken-php'),
      )),
    );
  }
  else {
    $form['api_key'] = array(
      '#title' => t('API Key'),
      '#type' => 'textfield',
      '#required' => TRUE,
      '#default_value' => $this->api_key,
    );
    $form['api_secret'] = array(
      '#title' => t('API Secret'),
      '#type' => 'textfield',
      '#required' => TRUE,
      '#default_value' => $this->api_secret,
    );
    $form['lossy'] = array(
      '#title' => t('Use lossy compression'),
      '#type' => 'checkbox',
      '#default_value' => $this->lossy,
    );
    $form['webp'] = array(
      '#title' => t('Use webp format'),
      '#type' => 'checkbox',
      '#default_value' => $this->webp,
    );
    $form['timeout'] = array(
      '#title' => t('Timeout (in seconds)'),
      '#type' => 'textfield',
      '#required' => TRUE,
      '#element_validate' => array(
        'element_validate_integer_positive',
      ),
      '#default_value' => $this->timeout,
    );
  }
  return $form;
}