You are here

function LorempixumProvider::settingsForm in Devel images provider 8

Same name and namespace in other branches
  1. 7 plugins/devel_image_provider/provider/LorempixumProvider.class.php \LorempixumProvider::settingsForm()

Generates a settings form for this handler.

Overrides DevelImagesProviderBase::settingsForm

File

plugins/devel_image_provider/provider/LorempixumProvider.class.php, line 17
Lorempixum support class.

Class

LorempixumProvider
Add support for lorempixum.com.

Code

function settingsForm() {
  $form = parent::settingsForm();

  // Provider specific settings.
  $form['devel_image_provider_' . $this->plugin['name']]['devel_image_provider_categories'] = array(
    '#type' => 'select',
    '#title' => t('Lorempixum Categories'),
    '#options' => drupal_map_assoc(array(
      'any',
      'abstract',
      'animals',
      'city',
      'food',
      'nightlife',
      'fashion',
      'people',
      'nature',
      'sports',
      'technics',
      'transport',
    )),
    '#multiple' => TRUE,
    '#size' => 12,
    '#default_value' => isset($this->settings['devel_image_provider_categories']) ? $this->settings['devel_image_provider_categories'] : 'any',
  );
  $form['devel_image_provider_' . $this->plugin['name']]['devel_image_provider_include_text'] = array(
    '#type' => 'radios',
    '#title' => t('Choose whether or not to add text inside the generated image'),
    '#default_value' => isset($this->settings['devel_image_provider_include_text']) ? $this->settings['devel_image_provider_include_text'] : 'default',
    '#options' => array(
      'default' => t('No text'),
      'random' => t('Random text'),
      'custom' => t('Custom text'),
    ),
  );
  $form['devel_image_provider_' . $this->plugin['name']]['devel_image_provider_custom_text'] = array(
    '#type' => 'textfield',
    '#title' => t('Custom Text'),
    '#maxlength' => 255,
    '#description' => t('Enter some custom text to be rendered instead of the default image dimensions.'),
    '#default_value' => isset($this->settings['devel_image_provider_custom_text']) ? $this->settings['devel_image_provider_custom_text'] : NULL,
    '#states' => array(
      'visible' => array(
        ':input[name="available_providers[devel_image_provider_method_selected][devel_image_provider_' . $this->plugin['name'] . '][devel_image_provider_include_text]"]' => array(
          'value' => 'custom',
        ),
      ),
    ),
  );
  return $form;
}