From 8b73a5daa4ada7663d5ce6775617656b2f62265a Mon Sep 17 00:00:00 2001 From: Herb v/d Dool Date: Sat, 30 Dec 2023 00:55:10 -0500 Subject: [PATCH] Issue #4: ensure flag config and sample views handled properly --- flag.module | 5 +++++ modules/flag_bookmark/flag_bookmark.install | 18 ++++++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/flag.module b/flag.module index 666f342..6fee2c4 100644 --- a/flag.module +++ b/flag.module @@ -18,6 +18,11 @@ function flag_config_info() { 'label' => t('Flag settings'), 'group' => t('Configuration'), ); + $prefixes['flag.flag'] = array( + 'name_key' => 'name', + 'label_key' => 'title', + 'group' => t('Flags'), + ); return $prefixes; } diff --git a/modules/flag_bookmark/flag_bookmark.install b/modules/flag_bookmark/flag_bookmark.install index da415bf..44b959c 100644 --- a/modules/flag_bookmark/flag_bookmark.install +++ b/modules/flag_bookmark/flag_bookmark.install @@ -52,6 +52,20 @@ function flag_bookmark_enable() { } } +/** + * Implements hook_uninstall(). + */ +function flag_bookmark_uninstall() { + // Remove default, un-modified views. + foreach (array('flag_bookmarks', 'flag_bookmarks_tab') as $view) { + $config = config('views.view.' . $view); + // Only update if view isn't overridden (VIEWS_STORAGE_OVERRIDE). + if ($config->get('storage') != 2) { + $config->delete(); + } + } +} + /** * Returns some node types to which the demonstration 'bookmarks' flag will * apply. @@ -260,7 +274,7 @@ function flag_bookmark_update_1000() { ), ) ); - $config->save(); + $config->save(); } $config = config('views.view.flag_bookmarks'); @@ -432,4 +446,4 @@ function flag_bookmark_update_1000() { ); $config->save(); } -} \ No newline at end of file +}