FilamentF
Filament14mo ago
Kaaiman

Issues when extending resource pages

I am running into issues when overriding pages from a resource. I configure the used resource in a config file from a filament plugin.
The idea for the plugin is to have basic resources (for standard implementations). Where I can extends the resources for custom implementations if needed.

I register the resource by using the following notation in the base resource pages:

public static function getResource(): string
{
    return config('package-config.topic.resource');
}


I publish the config file in my project and edit the resource to be the CustomTopicResource.

Example:

Package/Plugin:
TopicResource
  • EditTopic
  • CreateTopic
  • ListTopics
  • ManageUsers
Laravel project:
CustomTopicResource extending the TopicResource of the plugin.
  • EditTopic
  • EditTopicChecklist (which also has to declare the getResource method)
Now if I visit the ManageUsers page, the EditTopicChecklist sub navigation item dissapears. Why is this? It is implementing the getResource method. I would have to extend the ManageUsers class to redeclare the static getResource method, which completely destroys the idea of having default implementation without needing to extend anything.

Is there a solution for this or am I doing something wrong here?
Was this page helpful?