You are here

public function WebformThirdPartySettingsManager::unsetThirdPartySetting in Webform 6.x

Same name and namespace in other branches
  1. 8.5 src/WebformThirdPartySettingsManager.php \Drupal\webform\WebformThirdPartySettingsManager::unsetThirdPartySetting()

Unsets a third-party setting.

Parameters

string $module: The module providing the third-party setting.

string $key: The setting name.

Return value

mixed The value.

Overrides ThirdPartySettingsInterface::unsetThirdPartySetting

File

src/WebformThirdPartySettingsManager.php, line 125

Class

WebformThirdPartySettingsManager
Webform third party settings manager.

Namespace

Drupal\webform

Code

public function unsetThirdPartySetting($module, $key) {
  $config = $this->configFactory
    ->getEditable('webform.settings');
  $config
    ->clear("third_party_settings.{$module}.{$key}");

  // If the third party is no longer storing any information, completely
  // remove the array holding the settings for this module.
  if (!$config
    ->get("third_party_settings.{$module}")) {
    $config
      ->clear("third_party_settings.{$module}");
  }
  $config
    ->save();
  return $this;
}