You are here

function drupagram_views_handler_field_images::options_form in Drupagram 7

Same name and namespace in other branches
  1. 6 views/drupagram_views_handler_field_images.inc \drupagram_views_handler_field_images::options_form()

Default options form provides the label widget that all fields should have.

Overrides views_handler_field::options_form

File

./drupagram_views_field_handlers.inc, line 239
Drupagram views field handlers.

Class

drupagram_views_handler_field_images
Field handler to provide simple renderer that turns a URL into a clickable link.

Code

function options_form(&$form, &$form_state) {
  parent::options_form($form, $form_state);
  $form['source'] = array(
    '#title' => t('Image Source'),
    '#type' => 'select',
    '#options' => array(
      'thumbnail' => t('Instagram: Thumbnail'),
      'standard_resolution' => t('Instagram: Standard resolution'),
      'low_resolution' => t('Instagram: Low resolution'),
      'local' => t('Local cache'),
    ),
    '#default_value' => $this->options['source'],
  );
  $form['secure'] = array(
    '#title' => t('Secure request'),
    '#description' => t('If checked, remote source images will be requested via https://'),
    '#type' => 'checkbox',
    '#default_value' => !empty($this->options['secure']),
    '#dependency' => array(
      'edit-options-source' => array(
        'thumbnail',
        'standard_resolution',
        'low_resolution',
      ),
    ),
  );
  if (module_exists('image')) {
    $styles = image_styles();
    $style_options = array(
      '' => t('Default'),
    );
    foreach ($styles as $style) {
      $style_options[$style['name']] = $style['name'];
    }
    $form['image_style'] = array(
      '#title' => t('Image style'),
      '#description' => t('Using <em>Default</em> will use the site-wide image style for user pictures set in the <a href="!account-settings">Account settings</a>.', array(
        '!account-settings' => url('admin/config/people/accounts', array(
          'fragment' => 'edit-personalization',
        )),
      )),
      '#type' => 'select',
      '#options' => $style_options,
      '#default_value' => $this->options['image_style'],
      '#dependency' => array(
        'edit-options-source' => array(
          'local',
        ),
      ),
    );
  }
  $form['link_to_post'] = array(
    '#title' => t('Link to post'),
    '#description' => t('If the link field is available, the image field will link to the Instagram post'),
    '#type' => 'checkbox',
    '#default_value' => !empty($this->options['link_to_post']),
  );
  $form['use_caption_for_alt_text'] = array(
    '#title' => t('Use caption for alt text'),
    '#description' => t('If the caption field is available, it will be used for alt text'),
    '#type' => 'checkbox',
    '#default_value' => !empty($this->options['use_caption_for_alt_text']),
  );
}