stafe-group-ab/filament-bookmarks-menu

This plugin let's you add a global bookmarks menu for users in Filament Admin

v1.0.8 2023-06-03 22:51 UTC

This package is auto-updated.

Last update: 2024-05-04 00:50:59 UTC


README

Latest Version on Packagist Total Downloads

Screen shot of Filament Bookmarks Menu

Screen shot of Filament User Menu

This Filament Plugin will add a bookmarks menu to your Filament Admin application. You can setup global items in this menu or let users add their own items. The plugin will render an add & remove bookmark icon on top of all pages where you want it.

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

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,

Excluding 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'],

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.