diff --git a/core/modules/forum/forum.install b/core/modules/forum/forum.install index 1f75055..267f014 100644 --- a/core/modules/forum/forum.install +++ b/core/modules/forum/forum.install @@ -111,6 +111,18 @@ function forum_enable() { } /** + * Implements hook_modules_preinstall(). + */ +function forum_modules_preinstall($modules) { + $list_boolean = Drupal::service('plugin.manager.entity.field.field_type')->getDefinition('list_boolean'); + if (empty($list_boolean) && in_array('forum', $modules)) { + // Make sure that the list_boolean field type is available before our + // default config is installed. + field_info_cache_clear(); + } +} + +/** * Implements hook_uninstall(). */ function forum_uninstall() { @@ -128,8 +140,11 @@ function forum_uninstall() { $field->delete(); } - // Purge field data now to allow taxonomy module to be uninstalled - // if this is the only field remaining. + // Purge field data now to allow taxonomy and options module to be uninstalled + // if this is the only field remaining. We need to run it twice because + // field_purge_batch() will not remove the instance and the field in the same + // pass. + field_purge_batch(10); field_purge_batch(10); // Allow to delete a forum's node type. $locked = Drupal::state()->get('node.type.locked');