function PluginSettingsBase::onDependencyRemoval

Same name and namespace in other branches
  1. 11.x core/lib/Drupal/Core/Field/PluginSettingsBase.php \Drupal\Core\Field\PluginSettingsBase::onDependencyRemoval()
  2. 10 core/lib/Drupal/Core/Field/PluginSettingsBase.php \Drupal\Core\Field\PluginSettingsBase::onDependencyRemoval()
  3. 8.9.x core/lib/Drupal/Core/Field/PluginSettingsBase.php \Drupal\Core\Field\PluginSettingsBase::onDependencyRemoval()
1 method overrides PluginSettingsBase::onDependencyRemoval()
TestFieldWidget::onDependencyRemoval in core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldWidget/TestFieldWidget.php
Informs the plugin that some configuration it depends on will be deleted.

File

core/lib/Drupal/Core/Field/PluginSettingsBase.php, line 153

Class

PluginSettingsBase
Base class for the Field API plugins.

Namespace

Drupal\Core\Field

Code

public function onDependencyRemoval(array $dependencies) {
  $changed = FALSE;
  if (!empty($this->thirdPartySettings) && !empty($dependencies['module'])) {
    $old_count = count($this->thirdPartySettings);
    $this->thirdPartySettings = array_diff_key($this->thirdPartySettings, array_flip($dependencies['module']));
    $changed = $old_count != count($this->thirdPartySettings);
  }
  return $changed;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.