public function InstagramBlockBlock::blockForm in Instagram Block 8.2
Same name and namespace in other branches
- 8.3 src/Plugin/Block/InstagramBlockBlock.php \Drupal\instagram_block\Plugin\Block\InstagramBlockBlock::blockForm()
- 8 src/Plugin/Block/InstagramBlockBlock.php \Drupal\instagram_block\Plugin\Block\InstagramBlockBlock::blockForm()
Overrides BlockPluginTrait::blockForm
File
- src/
Plugin/ Block/ InstagramBlockBlock.php, line 104
Class
- InstagramBlockBlock
- Provides an Instagram block.
Namespace
Drupal\instagram_block\Plugin\BlockCode
public function blockForm($form, FormStateInterface $form_state) {
$form['authorise'] = [
'#markup' => $this
->t('Instagram Block requires connecting to a specific Instagram account. You need to be able to log into that account when asked to. The @help page helps with the setup.', [
'@help' => Link::fromTextAndUrl($this
->t('Authenticate with Instagram'), Url::fromUri('https://www.drupal.org/node/2746185'))
->toString(),
]),
];
$form['access_token'] = [
'#type' => 'textfield',
'#title' => $this
->t('Access Token'),
'#description' => $this
->t('Your Instagram access token. Eg. 460786509.ab103e5.a54b6834494643588d4217ee986384a8'),
'#default_value' => $this->configuration['access_token'],
];
$form['count'] = [
'#type' => 'number',
'#title' => $this
->t('Number of images to display'),
'#default_value' => $this->configuration['count'],
];
$form['width'] = [
'#type' => 'number',
'#title' => $this
->t('Image width in pixels'),
'#default_value' => $this->configuration['width'],
];
$form['height'] = [
'#type' => 'number',
'#title' => $this
->t('Image height in pixels'),
'#default_value' => $this->configuration['height'],
];
$image_options = [
'thumbnail' => $this
->t('Thumbnail (150x150)'),
'low_resolution' => $this
->t('Low (320x320)'),
'standard_resolution' => $this
->t('Standard (640x640)'),
];
$form['img_resolution'] = [
'#type' => 'select',
'#title' => $this
->t('Image resolution'),
'#description' => $this
->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'] = [
'#type' => 'number',
'#title' => $this
->t('Cache time in minutes'),
'#description' => $this
->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;
}