You are here

public function InstagramBlockBlock::blockForm in Instagram Block 8

Same name and namespace in other branches
  1. 8.3 src/Plugin/Block/InstagramBlockBlock.php \Drupal\instagram_block\Plugin\Block\InstagramBlockBlock::blockForm()
  2. 8.2 src/Plugin/Block/InstagramBlockBlock.php \Drupal\instagram_block\Plugin\Block\InstagramBlockBlock::blockForm()

Overrides BlockPluginTrait::blockForm

File

src/Plugin/Block/InstagramBlockBlock.php, line 94
Contains \Drupal\instagram_block\Plugin\Block\InstagramBlockBlock.

Class

InstagramBlockBlock
Provides an Instagram block.

Namespace

Drupal\instagram_block\Plugin\Block

Code

public function blockForm($form, FormStateInterface $form_state) {
  $form['count'] = array(
    '#type' => 'number',
    '#title' => t('Number of images to display.'),
    '#default_value' => $this->configuration['count'],
  );
  $form['width'] = array(
    '#type' => 'number',
    '#title' => t('Image width in pixels.'),
    '#default_value' => $this->configuration['width'],
  );
  $form['height'] = array(
    '#type' => 'number',
    '#title' => t('Image height in pixels.'),
    '#default_value' => $this->configuration['height'],
  );
  $image_options = array(
    'thumbnail' => t('Thumbnail (150x150)'),
    'low_resolution' => t('Low (320x320)'),
    'standard_resolution' => t('Standard (640x640)'),
  );
  $form['img_resolution'] = array(
    '#type' => 'select',
    '#title' => t('Image resolution'),
    '#description' => t('Choose the quality of the images you would like to display.'),
    '#default_value' => $this->configuration['img_resolution'],
    '#options' => $image_options,
  );
  $form['cache_time_minutes'] = array(
    '#type' => 'number',
    '#title' => t('Cache time in minutes'),
    '#description' => t("Default is 1440 - 24 hours. This is important for performance reasons and so the Instagram API limits isn't reached on busy sites."),
    '#default_value' => $this->configuration['cache_time_minutes'],
  );
  return $form;
}