Closed Ch4mpl00 closed 3 years ago
Hi. Have you tried inheriting from creating from abstract resource class?
Hi. Have you tried inheriting from creating from abstract resource class?
Hi! Yep I tried to make something like this:
class CurrencyResource extends Resource {...}
and then I added
class MyCurrencyResource extends CurrencyResource {...}
It created 2 menu items: 'Currency' and 'MyCurrency'
then I tried to make same label()
for both classes and I got just 'Currency' in menu, so it just ignored 'MyCurrency'
Use abstract classes. They won't be loaded abstract class CurrencyResource extends Resource
Yes but if I'll use abstract classes then app that uses my package will be forced to extend it. I'd like to make it optional i.e. "you can use it out of the box or extend it if you need"
It would be great to have something like symfony forms extensions
CurrencyResourceExtension extends ResourceExtension {
public static function getExtendedTypes(): iterable
{
return [CurrencyResource::class];
}
}
If you want to have resource classes for an optional inheritance, and are not abstract and not loaded in the user interface. Then change their location. We automatically connect only those that are in the Orchid/Resources
directory
There are some cases when I may want to override/extend an existing resource I.e. I make some package that uses orchid crud and I want to be able to extend it from my app.
Can't figure out how to do it, can you please suggest me a solution?