You are here

public function BrowscapAdmin::refreshSubmit in Browscap 8.3

Submit callback for the 'Refresh browscap data' submit.

Performs an import then records when it completed.

File

src/Form/BrowscapAdmin.php, line 118

Class

BrowscapAdmin
Defines Browscap administration form.

Namespace

Drupal\browscap\Form

Code

public function refreshSubmit(array &$form, FormStateInterface $form_state) {

  // Update the browscap information.
  $endpoint = new BrowscapEndpoint();
  \Drupal::service('browscap.importer')
    ->import($endpoint, FALSE);

  // Record when the browscap information was updated.
  $this
    ->config('browscap.settings')
    ->set('imported', REQUEST_TIME)
    ->save();
}