You are here

public function AdminSettings::submitForm in Doubleclick for Publishers (DFP) 8

Form submission handler.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Overrides ConfigFormBase::submitForm

File

src/Form/AdminSettings.php, line 211
Contains \Drupal\dfp\Form\AdminSettings.

Class

AdminSettings
Defines a form that configures DFP global settings.

Namespace

Drupal\dfp\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $values = $form_state
    ->getValues();
  if (!$values['async_rendering']) {
    $values['disable_init_load'] = FALSE;
  }
  $this
    ->config('dfp.settings')
    ->set('network_id', $values['network_id'])
    ->set('adunit_pattern', $values['adunit_pattern'])
    ->set('click_url', $values['click_url'])
    ->set('async_rendering', $values['async_rendering'])
    ->set('disable_init_load', $values['disable_init_load'])
    ->set('single_request', $values['single_request'])
    ->set('default_slug', $values['default_slug'])
    ->set('collapse_empty_divs', $values['collapse_empty_divs'])
    ->set('adtest_adunit_pattern', $values['adtest_adunit_pattern'])
    ->set('targeting', $values['targeting'])
    ->set('hide_slug', $values['hide_slug'])
    ->save();
}