Skip to content

Conversation

@ryangjchandler
Copy link
Contributor

@ryangjchandler ryangjchandler commented Jan 21, 2026

Description

Render hooks are commonly used to customize the Filament experience further, especially inside of panels.

One limitation that I personally find with the renderHook() method is that certain views require custom data and placing all of that logic inside of the panel provider or a service provider can become rather messy.

A workaround for this that already exists is creating a class to handle the rendering, but it still requires some manual wiring to work correctly, especially when dependency injection is involved.

This pull request introduces the concept of a RenderHook class with support for auto-discovery.

You create a class that extends Filament\View\RenderHook and implement the necessary methods. You specify the hook(s) you want to render for and the View or string that should be rendered.

Classes are resolved from the container so dependency injection works as expected and you can pull in service classes for data retrieval etc.

By adding ->discoverRenderHooks() onto your Panel object, specifying the directory and namespace, you get the real benefit of auto-discovered render hooks, removing the need for that superfluous method call.

Visual changes

N/A

Functional changes

  • Code style has been fixed by running the composer cs command.
  • Changes have been tested to not break existing functionality.
  • Documentation is up-to-date.

@github-project-automation github-project-automation bot moved this to Todo in Roadmap Jan 21, 2026
@danharrin danharrin added the enhancement New feature or request label Jan 21, 2026
@danharrin danharrin modified the milestones: v5, v4 Jan 21, 2026
@ryangjchandler ryangjchandler changed the base branch from 5.x to 4.x January 21, 2026 12:29
@ryangjchandler ryangjchandler changed the title [5.x] Render hook classes [4.x] Render hook classes Jan 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request pending review

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

3 participants