public function EmailField::onDependencyRemoval in Workbench Email 8
Same name and namespace in other branches
- 2.x src/Plugin/RecipientType/EmailField.php \Drupal\workbench_email\Plugin\RecipientType\EmailField::onDependencyRemoval()
Informs the plugin that a dependency of the recipient type will be deleted.
@todo https://www.drupal.org/node/2579743 make part of a generic interface.
Parameters
array $dependencies: An array of dependencies that will be deleted keyed by dependency type.
Return value
bool TRUE if the template settings have been changed.
Overrides RecipientTypeBase::onDependencyRemoval
See also
\Drupal\Core\Config\ConfigEntityInterface::onDependencyRemoval()
File
- src/
Plugin/ RecipientType/ EmailField.php, line 180
Class
- EmailField
- Provides a recipient type of an email field.
Namespace
Drupal\workbench_email\Plugin\RecipientTypeCode
public function onDependencyRemoval(array $dependencies) {
$removed_fields = array_reduce($dependencies['config'], function (array $carry, $item) {
if (!$item instanceof FieldStorageConfigInterface) {
return $carry;
}
$carry[] = sprintf('%s:%s', $item
->getTargetEntityTypeId(), $item
->getName());
return $carry;
}, []);
if ($removed_fields && array_intersect($removed_fields, $this
->getFields())) {
$this
->setFields(array_diff($this
->getFields(), $removed_fields));
return TRUE;
}
return FALSE;
}