mybb2
mybb2 copied to clipboard
Remove the `laravelcollective/html` package
I'm not sure what the original intent was, but we should remove laravelcollective/html
. It makes things unduly complex and difficult. For instance, one is limited when opening a form to the following:
{{ form_open({'route': ['topics.reply', topic.id, topic.slug], 'method': 'post', 'id': 'topicreply'}) }}
You cannot instead do:
{{ form_open({'route': ['topics.reply', {'id': topic.id, 'slug': topic.slug}], 'method': 'post', 'id': 'topicreply'}) }}
Constructing a <form>
tag isn't difficult, so there's not much use for the library in my opinion.
You could use
form_open({'url': url_route('topics.reply', {'slug': topic.slug, 'id': topic.id}), 'method': 'post', 'id': 'quickreply'})
to generate forms ^^ looks ugly ...
Yeah, it's easier to just use the proper tag IMO. Gets rid of a dependency too hopefully.
Maybe it's easier for
https://github.com/mybb/mybb2/blob/master/resources/views/admin/partials/users/profile_field_form.twig#L12 for example
Yeah, we could probably define a twig extensions for select boxes that just renders a template.
I personally prefer to use laravelcollective/html
instead of using <form>
... (it's easier for CSRF, selects and ...)
We can ask @laravelcollective to add a way to use
{{ form_open({'route': ['topics.reply', {'id': topic.id, 'slug': topic.slug}], 'method': 'post', 'id': 'topicreply'}) }}
Either way, we need to be able to use a hash rather than relying on positional arguments.
@ATofighi there is the csrf_field()
function for generating a csrf form field in laravel 5.2 ... no need to use laravelcollective/html
for this ... A whole package just for two functions ...
Imo twig extensions for form opening and selects are a better idea ...
We could always do <form action="{!! route('topics.reply', ['id' => topic.id, 'slug' => topic.slug]) !!}" method="post">
, that would be the proper way of doing it.
Yep, that's how I've been fixing it personally.
On 30 Mar 2016, at 15:51, Eric Hocking [email protected] wrote:
We could always do
It's will be removed and all forms will be created using normal html tags? I've started doing user management in ACP. What way i should create forms?
Yes, that's the plan. To create forms, you should write the normal HTML for a form, and use {{ url_route() }}
to crate the URL the form submits to 😄
I agree with removing this is makes it unnecessarily complex, when has there even been a problem with writing standard HTML?
@036 Writing HTML isn't a problem but populating a form manually is more difficult. The package provides a convenient way to bind models to forms: https://laravelcollective.com/docs/5.3/html#form-model-binding
Using laravel collective with vue is really big problem and not working together so if you want in the future use vue, you will need replace form created with collective to html forms.