https://twill.io logo
Additional props to repeater component
# ❓questions
e
Can I send additional data to a repeater form view?
k
Hello, do you have something like this in the Repository?
Copy code
php
    public function getFormFields($object)
    {
        $fields = parent::getFormFields($object);
        $fields = $this->getFormFieldsForRepeater($object, $fields, 'members', 'TeamMember', 'team-member');
        return $fields;
    }
You can always
dd($fields)
after
getFormFieldsForRepeater
, repeter fields for frontend will be there, so any additional data can be appended there.
e
Hi, I'll try now. Thanks!
I need something like formData, to use in formview like :options="$sectors"
k
So what prevents you from using
formData
? You can also access form fields via
$form_fields
in the form view.
e
formData not working in a repeater form view
k
You need data passed directly to the vue component? As props
e
exactly like the multi select example
but in a repeater
Undefined variable $form_fields (View: /home/scena9/public_html/.new/vendor/area17/twill/views/partials/form/utils/_blocks_templates.blade.php)
k
Oh I see,
$form_fields
will not be present there, since that variable is available only in the
/yourmodule/form.blade.php
, you need to pass wanted data trough that
@formField
and it will be available in the component in which you are calling Vue component.
Are you on the 3x or 2x version, since screenshot above is from the 3.x Twill docs?
e
3
k
Im not using Twill 3 yet fully, but this should work.
Copy code
php
<x-twill::repeater
    type="video"
    :options="$sectors"
/>
And in the
area17/twill/views/partials/form/utils/_blocks_templates.blade.php
you can pass that
$options
to the Vue component. But this error above tells me that you are editing vendor files directly, you should override that template file, not mess with the vendor files, since they will be overwritten on composer update action.
e
no, I'm not editing vendor files
k
But error jumps from vendor file, can you show us where you want to pass data? In which blade component.
e
in resources/views/twill/repeaters/article_author.blade.php
I'll try to find another solution. Thanks!
2 Views