Closed stevebauman closed 9 years ago
Woah, i'm really surprised about usage in another package :) Can i get the view on it somewhere? :)
Here are some solutions for this, though not ideal:
Form
class that extends this package Form
class, override setFormOptions
, and load customFields, like this:<?php
use Kris\LaravelFormBuilder\Form;
abstract class YourForm extends Form {
public function setFormOptions($formOptions)
{
$this->addCustomField(
'select-category',
'Stevebauman\Maintenance\Forms\Fields\WorkOrderCategoryField'
);
$this->addCustomField(
'select-something-else',
'Stevebauman\Maintenance\Forms\Fields\WorkOrderCategoryFieldSomethingelse'
);
return parent::setFormOptions($formOptions);
}
Did you try using maybe http://laravel.com/docs/4.2/configuration#provider-configuration ? I haven't tested it.
Awesome! Your second option works! Thanks a ton!
Also it'll be integrated into my package in development Maintenance so if you'd like to see it it'll be in there :).
On another note, sorry if I should be creating a new issue for this, but any chance of a version bump for the Laravel 4 version to v1.0
instead of v0.1
? I think that this package is tested and stable enough to warrant a 1.0
realease, what are your thoughts?
I have a small problem with that, because i didn't start versioning properly. At first i thought creating this package only for Laravel 5, but since there were requests for Laravel 4, I just added it as another branch and use versioning from 0.* . This now causes the problems because Laravel 5 is from version v1.* , and Laravel 4 version is from v0.* . I'm trying to think of solution that will not break backward compatibility. Will probably leave this repo for laravel4, and create another one for laravel5. Will let you know.
@stevebauman I moved laravel 4 version to another repo. laravel4-form-builder, and this one is now used only for laravel 5. I will keep them both up to date.
I'm having trouble adding custom fields from inside a separate package.
The problem:
Since I'm using this package from another package, I can't seem to modify / override the custom fields array from your package config file. I've also added your service provider before mine so there shouldn't be an issue of your service provider overriding the config values I've just set.
I've tried modifying the config at runtime through my packages service provider in the
register()
function like so:I can add these custom fields fine when building the form like you've shown in the documentation (which is also amazing), but I need these custom fields available for all of my forms unfortunately.
Would you happen to know anything I can try?
Thanks for the great package!
EDIT:
I have tried this in my
register()
function as well:But this gives a
View [] not found
exception in my blade view where I call the{{ form($form) }}
function