- Issue created by @alex.skrypnyk
- 🇦🇺Australia imclean Tasmania
I came across this recently where installing the subtheme via the GUI timed out the first time then didn't seem to properly install and I got the error in 🐛 Installing civictheme via drush results in "This block is broken or missing." on main page Postponed: needs info . I uninstalled the subtheme and reinstalled it but still had the same error.
When I then set CivicTheme as the default it also had the missing block error, even though it was fine the first time I tested it. I then uninstalled the subtheme and CivicTheme and tried to reinstall CivicTheme and got the error: "Configuration (...) provided by civictheme already exist in active configuration".
This is with a fresh install of GovCMS so I can just reinstall it again but this may not be the case in all situations.
- 🇮🇳India divyansh.gupta Jaipur
I created this civictheme.install file:
<?php/**
* @file
* Includes uninstall code.
*//**
* Implements hook_uninstall().
*/
function civictheme_uninstall() {// Log the start of the uninstall process.
\Drupal::logger('civictheme')->notice('Uninstall process started.');// Load all configuration names.
$config_names = \Drupal::configFactory()->listAll();// Array of configurations to delete.
$configurations_to_delete = [
// Add other specific configurations as needed.
'core.entity_view_mode.media.component',
'core.entity_view_mode.media.embedded',
'field.storage.block_content.field_c_b_background_image',
'field.storage.block_content.field_c_b_banner_blend_mode',
'field.storage.block_content.field_c_b_banner_type',
'field.storage.block_content.field_c_b_bottom',
'field.storage.block_content.field_c_b_components',
'field.storage.block_content.field_c_b_featured_image',
'field.storage.block_content.field_c_b_link',
'field.storage.block_content.field_c_b_social_icons',
'field.storage.block_content.field_c_b_theme',
'field.storage.block_content.field_c_b_top',
'field.storage.block_content.field_c_b_trigger_text',
'field.storage.block_content.field_c_b_trigger_theme',
'field.storage.block_content.field_c_b_with_border',
'field.storage.media.field_c_m_audio_file',
'field.storage.media.field_c_m_caption',
'field.storage.media.field_c_m_document',
'field.storage.media.field_c_m_icon',
'field.storage.media.field_c_m_image',
'field.storage.media.field_c_m_media_tags',
'field.storage.media.field_c_m_oembed_video',
'field.storage.media.field_c_m_transcript',
'field.storage.media.field_c_m_transcript_link',
'field.storage.media.field_c_m_video_file',
'field.storage.node.field_c_n_alert_page_visibility',
'field.storage.node.field_c_n_alert_type',
'field.storage.node.field_c_n_attachments',
'field.storage.node.field_c_n_banner_background',
'field.storage.node.field_c_n_banner_blend_mode',
'field.storage.node.field_c_n_banner_components',
'field.storage.node.field_c_n_banner_components_bott',
'field.storage.node.field_c_n_banner_featured_image',
'field.storage.node.field_c_n_banner_hide_breadcrumb',
'field.storage.node.field_c_n_banner_theme',
'field.storage.node.field_c_n_banner_title',
'field.storage.node.field_c_n_banner_type',
'field.storage.node.field_c_n_body',
'field.storage.node.field_c_n_components',
'field.storage.node.field_c_n_custom_last_updated',
'field.storage.node.field_c_n_date_range',
'field.storage.node.field_c_n_hide_sidebar',
'field.storage.node.field_c_n_hide_tags',
'field.storage.node.field_c_n_location',
'field.storage.node.field_c_n_show_last_updated',
'field.storage.node.field_c_n_show_toc',
'field.storage.node.field_c_n_site_section',
'field.storage.node.field_c_n_summary',
'field.storage.node.field_c_n_thumbnail',
'field.storage.node.field_c_n_topics',
'field.storage.node.field_c_n_vertical_spacing',
'field.storage.paragraph.field_c_p_address',
'field.storage.paragraph.field_c_p_attachments',
'field.storage.paragraph.field_c_p_attributes',
'field.storage.paragraph.field_c_p_background',
'field.storage.paragraph.field_c_p_cards',
'field.storage.paragraph.field_c_p_content',
'field.storage.paragraph.field_c_p_date',
'field.storage.paragraph.field_c_p_date_range',
'field.storage.paragraph.field_c_p_default_panel',
'field.storage.paragraph.field_c_p_document',
'field.storage.paragraph.field_c_p_embed_url',
'field.storage.paragraph.field_c_p_expand',
'field.storage.paragraph.field_c_p_footer_link',
'field.storage.paragraph.field_c_p_header_link',
'field.storage.paragraph.field_c_p_height',
'field.storage.paragraph.field_c_p_icon',
'field.storage.paragraph.field_c_p_image',
'field.storage.paragraph.field_c_p_image_position',
'field.storage.paragraph.field_c_p_link',
'field.storage.paragraph.field_c_p_link_text',
'field.storage.paragraph.field_c_p_links',
'field.storage.paragraph.field_c_p_list_column_count',
'field.storage.paragraph.field_c_p_list_content_type',
'field.storage.paragraph.field_c_p_list_fill_width',
'field.storage.paragraph.field_c_p_list_filters_exp',
'field.storage.paragraph.field_c_p_list_item_theme',
'field.storage.paragraph.field_c_p_list_item_view_as',
'field.storage.paragraph.field_c_p_list_items',
'field.storage.paragraph.field_c_p_list_limit',
'field.storage.paragraph.field_c_p_list_limit_type',
'field.storage.paragraph.field_c_p_list_link_above',
'field.storage.paragraph.field_c_p_list_link_below',
'field.storage.paragraph.field_c_p_list_site_sections',
'field.storage.paragraph.field_c_p_list_topics',
'field.storage.paragraph.field_c_p_list_type',
'field.storage.paragraph.field_c_p_location',
'field.storage.paragraph.field_c_p_panels',
'field.storage.paragraph.field_c_p_reference',
'field.storage.paragraph.field_c_p_show_image_as_icon',
'field.storage.paragraph.field_c_p_slides',
'field.storage.paragraph.field_c_p_subtitle',
'field.storage.paragraph.field_c_p_summary',
'field.storage.paragraph.field_c_p_theme',
'field.storage.paragraph.field_c_p_title',
'field.storage.paragraph.field_c_p_topics',
'field.storage.paragraph.field_c_p_url',
'field.storage.paragraph.field_c_p_vertical_spacing',
'field.storage.paragraph.field_c_p_view_link',
'field.storage.paragraph.field_c_p_webform',
'field.storage.paragraph.field_c_p_width',
];// Loop through all configuration names.
foreach ($config_names as $config_name) {
// Check if the config name contains 'civictheme' or is in the
// specific configurations.
if (strpos($config_name, 'civictheme') !== FALSE || in_array($config_name, $configurations_to_delete)) {
$config = \Drupal::configFactory()->getEditable($config_name);
// Delete the configuration.
$config->delete();
// Log a message.
\Drupal::logger('civictheme')->notice('Deleted configuration: @name', ['@name' => $config_name]);
}
}}
but it is not being called while uninstalling but when i tried it other themes and modules it is working fine even it is running if i am running this through cron but .install file is not being called while uninstallling.
So if someone can help me solve this completely.