You are here

protected function SettingsForm::deleteObsoleteConfigEntities in Content Planner 8

Check which config entity needs to be deleted.

Parameters

array $selected_content_types:

\Drupal\content_calendar\Entity\ContentTypeConfig[] $config_entities:

1 call to SettingsForm::deleteObsoleteConfigEntities()
SettingsForm::submitForm in modules/content_calendar/src/Form/SettingsForm.php
Form submission handler.

File

modules/content_calendar/src/Form/SettingsForm.php, line 318

Class

SettingsForm
Defines a form that configures forms module settings.

Namespace

Drupal\content_calendar\Form

Code

protected function deleteObsoleteConfigEntities(array $selected_content_types, array &$config_entities) {
  foreach ($config_entities as $config_entity_id => $config_entity) {
    if (!in_array($config_entity_id, $selected_content_types)) {
      $this
        ->messenger()
        ->addMessage(t('Content Type @name has been removed from Content Calendar.', [
        '@name' => $config_entity
          ->label(),
      ]));
      $config_entity
        ->delete();
    }
  }
}