Commit 97800916 authored by andrei.dincu's avatar andrei.dincu

Issue #2249723 by andrei.dincu: Remove entity state variables in hook_uninstall()

parent 77adc383
......@@ -398,6 +398,18 @@ function xmlsitemap_uninstall() {
// Remove the file cache directory.
xmlsitemap_clear_directory(NULL, TRUE);
$entities = \Drupal::entityManager()->getDefinitions();
$bundles = \Drupal::entityManager()->getAllBundleInfo();
$state_variables = array();
foreach ($entities as $entity_id => $entity) {
$state_variables[] = 'xmlsitemap_entity_' . $entity_id;
foreach ($bundles[$entity_id] as $bundle_id => $bundle) {
$state_variables[] = 'xmlsitemap_entity' . $entity_id . '_bundle_' . $bundle_id;
}
}
\Drupal::state()->deleteMultiple($state_variables);
}
/**
......
......@@ -1289,7 +1289,6 @@ function xmlsitemap_calculate_changefreq($timestamps) {
* calls to variable_set().
*/
function xmlsitemap_form_submit_flag_regenerate($form, $form_state) {
drupal_set_message('bogdan are mere');
foreach ($form_state['values'] as $variable => $value) {
if (\Drupal::config('xmlsitemap.settings')->get($variable) == NULL) {
$stored_value = 'not_a_variable';
......@@ -2065,7 +2064,6 @@ function xmlsitemap_form_language_admin_overview_form_alter(&$form, $form_state)
if (!\Drupal::moduleHandler()->moduleExists('language') || !\Drupal::moduleHandler()->moduleExists('config_translation')) {
return;
}
drupal_set_message(count($form['#submit']));
array_unshift($form['#submit'], 'xmlsitemap_form_submit_flag_regenerate');
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment