You are here

public function BlockUploadBlock::blockSubmit in Block Upload 8

Overrides BlockPluginTrait::blockSubmit

File

src/Plugin/Block/BlockUploadBlock.php, line 111

Class

BlockUploadBlock
Provides a Custom block.

Namespace

Drupal\block_upload\Plugin\Block

Code

public function blockSubmit($form, FormStateInterface $form_state) {
  $block_id = 'block_upload_' . $form_state
    ->getValue('block_upload_id') . '_';
  \Drupal::state()
    ->set($block_id . 'field', $form_state
    ->getValue($block_id . 'field'));
  $settings = [];
  $settings['alt'] = $form_state
    ->getValue([
    'config',
    $block_id . 'alt',
  ]);
  $settings['title'] = $form_state
    ->getValue([
    'config',
    $block_id . 'title',
  ]);
  $settings['desc'] = $form_state
    ->getValue([
    'config',
    $block_id . 'desc',
  ]);
  $settings['plupload'] = $form_state
    ->getValue($block_id . 'plupload_status');
  \Drupal::state()
    ->set($block_id . 'settings', $settings);
}