You are here

public function VisibilityConfigurationForm::verticalTabsConfigSaveConfig in Vertical Tabs Config 8

Save all configuration.

Parameters

array $config: The array ready to save to database.

1 call to VisibilityConfigurationForm::verticalTabsConfigSaveConfig()
VisibilityConfigurationForm::submitForm in src/Form/VisibilityConfigurationForm.php
Form submission handler.

File

src/Form/VisibilityConfigurationForm.php, line 180

Class

VisibilityConfigurationForm
Configure visibility for this site.

Namespace

Drupal\vertical_tabs_config\Form

Code

public function verticalTabsConfigSaveConfig(array $config) {
  $query = Database::getConnection()
    ->insert('vertical_tabs_config')
    ->fields([
    'vertical_tab',
    'content_type',
    'roles',
    'hidden',
  ]);
  foreach ($config as $record) {
    $query
      ->values($record);
  }
  try {
    Database::getConnection()
      ->delete('vertical_tabs_config')
      ->execute();
    $query
      ->execute();
  } catch (Exception $e) {
    $this->logger
      ->notice($e
      ->getMessage());
  }
}