You are here

protected function SiteSettingsReplicator::cleanSettings in Site Settings and Labels 8

Clean the settings.

Remove any settings that are completely empty as there is nothing to process for those.

Parameters

array $settings: The settings from the replicate form.

Return value

int The cleaned settings.

1 call to SiteSettingsReplicator::cleanSettings()
SiteSettingsReplicator::processBatch in src/SiteSettingsReplicator.php
Process callback for the batch set the export form.

File

src/SiteSettingsReplicator.php, line 136

Class

SiteSettingsReplicator
Class SiteSettingsReplicator.

Namespace

Drupal\site_settings

Code

protected function cleanSettings(array $settings) {
  $new_settings = [];
  foreach ($settings['values']['new_settings'] as $key => $setting) {
    if (!empty($setting['machine_name']) && !empty($setting['label']) && !empty($setting['fieldset'])) {
      $new_settings[] = $setting;
    }
  }
  $settings['values']['new_settings'] = $new_settings;
  return $settings;
}