• Bookmarks Menu

Bookmarks Menu

Plugin information

by Andreas Kviby

Admin panel

This Filament Plugin will add a bookmarks menu to your Filament Admin application.

Support

#bookmarks-menu on Discord

Views

2775

License

MIT

Documentation

This plugin will add a Bookmark Icon to all pages where your users can bookmark the pages into their personal bookmark menu. You can also add global bookmarks by using the supplied Bookmark Resource.

This way you can add shortcuts that you want all your users to have fast access to. To can even add external links and set the target for them, like _blank for external urls.

Now you can enable / disable labels in the menu and there is also a way for your users to delete items directly inside the menu.

Screenshot of bookmark menu The user can add any allowed page(s) to their own bookmark menu by clicking the bookmark icon on any page.

Screenshot of bookmark icon The admin can setup global bookmarks for all users and they will be added to the menu as the personal ones.

Installation

You can install the package via composer:

composer require stafe-group-ab/filament-bookmarks-menu

You can publish and run the migrations with:

php artisan vendor:publish --tag="filament-bookmarks-menu-migrations"
php artisan migrate

You can publish the config file with:

php artisan vendor:publish --tag="filament-bookmarks-menu-config"

This is the contents of the published config file, here you can alter icons, colors and more with ease.

return [
'bookmark_icon' => 'heroicon-o-bookmark',
'bookmark_class' => 'w-5 h-5 cursor-pointer text-gray-700 dark:text-gray-200',
'add_bookmark_icon' => 'heroicon-o-bookmark',
'remove_bookmark_icon' => 'heroicon-s-bookmark',
'add_bookmark_class' => 'w-6 h-6 cursor-pointer text-danger-700 dark:text-gray-200',
'remove_bookmark_class' => 'w-6 h-6 cursor-pointer text-danger-700 dark:text-gray-200',
'add_bookmarks_by_users' => true,
'exclude_pages' => ['admin', 'bookmarks-menus'],
'notification_add_icon' => 'heroicon-o-bookmark',
'notification_remove_icon' => 'heroicon-o-bookmark',
'notification_add_color' => 'success',
'notification_remove_color' => 'danger',
'show_resource_in_navigation' => false,
'delete_icon' => 'heroicon-o-trash',
'delete_class' => 'w-5 h-5 cursor-pointer text-danger-700 dark:text-gray-200',
'delete_text_class' => 'cursor-pointer text-white bg-black dark:text-gray-200',
'show_private_label_in_menu' => false,
'show_global_label_in_menu' => false,
];

Optionally, you can publish the views using

php artisan vendor:publish --tag="filament-bookmarks-menu-views"

Optionally, you can publish the translation files, we will ship in English only

php artisan vendor:publish --tag="filament-bookmarks-menu-translations"

Usage

The Bookmark Component

To offer your logged in users the ability to add favorites to their personal bookmarks menu make sure you go to the config file and set the below. That will make the plugin render the add / remove bookmark icon feature on all pages.

'add_bookmarks_by_users' => true,

Delete items in the menu

Now your users will see a svg trash icon next to all their private menu items. You can config this icon and colors in the config file. You can also set the label in the updated lang files.

'delete_icon' => 'heroicon-o-trash',
'delete_class' => 'w-5 h-5 cursor-pointer text-danger-700 dark:text-gray-200',
'delete_text_class' => 'cursor-pointer text-white bg-black dark:text-gray-200',

Displaying labels in the bookmarks menu?

Now you can enable / disable the Global & Private labels in the Bookmarks Menu in the config file.

'show_private_label_in_menu' => false,
'show_global_label_in_menu' => false,

Exclude pages

In almost all cases there will be pages that you want to exclude from this plugin. There is an array in the config file where you can add the exclusions you want. It will exclude in the ending string in all urls in your Filament Admin. So if you exclude edit below no edit pages will be available in the plugin.

'exclude_pages' => ['admin', 'bookmarks-menus'],

The Bookmarks Resource

The plugin will automatically add a new Resource to manage the bookmarks in your application. We recommend that you use Filament Shield to hide this resource and the functionally of it to user with less permissions.

If you as an admin creates bookmarks in this resource and do not select a user it will be added as a global menu item for all your users. This is perfect for adding shortcuts for all users to pages or other systems for your users.

menu label = The label in the menu menu url = The full url for the item menu_target = The target, like _top, _blank menu_user_id = If set it will only show up for that user, if not it will be global sort_order = Not applied yet