You are here

public function FacebookAlbumBlock::blockSubmit in Facebook Album 8

Overrides BlockPluginTrait::blockSubmit

File

src/Plugin/Block/FacebookAlbumBlock.php, line 131
Contains \Drupal\facebook_album\Plugin\Block\FacebookAlbumBlock.

Class

FacebookAlbumBlock
Defines a facebook album block block type.

Namespace

Drupal\facebook_album\Plugin\Block

Code

public function blockSubmit($form, FormStateInterface $form_state) {
  $this
    ->setConfigurationValue('page_id', $form_state
    ->getValue('page_id'));

  // Get the display values
  $fieldset_values = $form_state
    ->getValue('display');

  // Save Albums as an array
  $albums = explode("\r\n", $fieldset_values['albums']);
  $this
    ->setConfigurationValue('albums', $albums);

  // Save the rest
  foreach ($fieldset_values as $key => $value) {
    if ($key != 'albums') {
      $this
        ->setConfigurationValue($key, $value);
    }
  }
}