You are here

public function PhotosUserImages::blockForm in Album Photos 8.4

Overrides BlockPluginTrait::blockForm

File

src/Plugin/Block/PhotosUserImages.php, line 150

Class

PhotosUserImages
Provides a 'Photos user images' block.

Namespace

Drupal\photos\Plugin\Block

Code

public function blockForm($form, FormStateInterface $form_state) {
  $form = parent::blockForm($form, $form_state);

  // Retrieve existing configuration for this block.
  $config = $this
    ->getConfiguration();

  // Add a form field to the existing block configuration form.
  $options = array_combine([
    1,
    2,
    3,
    4,
    5,
    6,
    7,
    8,
    9,
    10,
    15,
    20,
    25,
    30,
    40,
  ], [
    1,
    2,
    3,
    4,
    5,
    6,
    7,
    8,
    9,
    10,
    15,
    20,
    25,
    30,
    40,
  ]);
  $form['image_count'] = [
    '#type' => 'select',
    '#title' => $this
      ->t('Number of images to display'),
    '#options' => $options,
    '#default_value' => isset($config['image_count']) ? $config['image_count'] : '',
  ];
  return $form;
}