agencetwogether/hookshelper

Simple plugin to toggle display hooks available in current page.

0.0.1 2024-11-22 22:33 UTC

This package is not auto-updated.

Last update: 2024-11-23 14:45:55 UTC


README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

This plugin allows you to easily look ALL render hooks available in Filament on current page with a toggle.

Table of contents

Installation

You can install the package via composer:

composer require agencetwogether/hookshelper

You can publish the config file with:

php artisan vendor:publish --tag="hookshelper-config"

This is the contents of the published config file:

return [
    /*
    |--------------------------------------------------------------------------
    | Render Hook
    |--------------------------------------------------------------------------
    | You may customize the render hook used to display the hooks visibility
    | toggle button. If null, this will be set to 'global-search.before'.
    | The 'panels::' prefix will be added automatically if omitted.
    |
    */
    'render_hook' => 'global-search.before',
    /*
    |--------------------------------------------------------------------------
    | Icon
    |--------------------------------------------------------------------------
    | You may select a different Heroicon to display for the hooks visibility
    | toggle button. If null, the default will be 'heroicon-m-cursor-arrow-rays'.
    |
    */
    'icon' => 'heroicon-m-cursor-arrow-rays',
    /*
    |--------------------------------------------------------------------------
    | Minify Button
    |--------------------------------------------------------------------------
    | Setting this to true will only display a small icon as a toggle button.
    | Otherwise, the button will display action label to perform.
    |
    */
    'tiny_toggle' => false,
];

You can publish the translations with:

php artisan vendor:publish --tag="hookshelper-translations"

Optionally, you can publish the views using

php artisan vendor:publish --tag="hookshelper-views"

Setup

First, instantiate the plugin in your Panel's configuration:

use Agencetwogether\HooksHelper\HooksHelperPlugin;

...

public function panel(Panel $panel) : Panel
{
    return $panel
        ->plugins([
            HooksHelperPlugin::make(),
        ]);
}

Usage

The plugin will add a toggle button to your Filament Admin Panel, left to the global search bar.

Clicking it will trigger display all hooks available in current page otherwise hide them.

image

image

Placement

The toggle button will be placed before the global search bar by default. If you want to change this, you can tweak the render_hook key in the config file.

You can use any of the render hooks provided by Filament.

Icon

The toggle button show an icon. If you want to change this, you can tweak the icon key in the config file.

Minify toggle

You can only show icon in toggle. If you want to set this, you can tweak the tiny_toggle key in the config file.

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

Thanks

License

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