Closed tricki closed 6 years ago
Hi @tricki,
I added support for a new data type color on PR #1494, you can see a complete list of the files changed, maybe this can help you.
Fell free to send a PR with your idea.
Thanks for the answer.
That's exactly what I thought I needed to change. But the type I want to add is one that won't be of any use to anyone else.
After looking through issues I saw several mentions of a plugin system (hooks) but I couldn't find any documentation on it. Installing it also didn't work because larapack/voyager-hooks requires larapack/hooks@^0.1.1 even though larapack/hooks has no versions..
I'm still evaluating whether to use Voyager for a project but I think I'll have to wait until the hooks feature is ready.
Labels: feature, question, discussion
This is very necessary.
We already has this feature in 1.0
. You can submit new form fields directly to Voyager via PR or add new Hook via FormFieldsRegistered event.
See: https://github.com/the-control-group/voyager/blob/1.0/src/VoyagerServiceProvider.php#L294
@handiwijoyo This only allows for the edit screen, the browse screen is still done with if statements.
This issue has been automatically locked since there has not been any recent activity after it was closed. If you have further questions please ask in our Slack group.
I'd like to create a new custom input type for the add/edit, browse and view routes.
As I understand the code (haven't tested it) I would have to call
Voyager::addFormField($handler)
and pass a class which implementsTCG\Voyager\FormFields\HandlerInterface
. This class is responsible for rendering the form element(s) for the field in the add/edit routes. This can be done easily.The problem is in the browse and view routes. There the rendering of the field types is done using
if/elseif
directly in the route. This is obviously not easy to extend.My thought was to add two new methods to
HandlerInterface
andAbstractHandler
that return the HTML needed to render the input type for each route. Also I would rename all form field routes (inresources/views/bread/formfields/
) toedit-add.blade.php
and move them to a separate subfolder.Any thoughts?