You are here

public function TwitterBlockBase::blockSubmit in Twitter Embed 8

Overrides BlockPluginTrait::blockSubmit

File

src/Plugin/Block/TwitterBlockBase.php, line 88

Class

TwitterBlockBase
TwitterBlockBase class.

Namespace

Drupal\twitter_embed\Plugin\Block

Code

public function blockSubmit($form, FormStateInterface $form_state) {
  foreach ($this->twitterWidget
    ->getAvailableSettings() as $key => $setting) {

    // @todo use recursivity to handle nested arrays
    // @todo could not fit with some values (checkboxes)
    if (is_array($setting)) {
      foreach ($setting as $childKey => $childSetting) {
        $this->configuration[$childKey] = $form_state
          ->getValue([
          $key,
          $childKey,
        ]);
      }
    }
    else {
      $this->configuration[$key] = $form_state
        ->getValue($key);
    }
  }
  $this->twitterWidget
    ->setDependentConfiguration($this->configuration);
}