Jump to content

Repeaters in module configurations


Recommended Posts

Hello everyone,

Is it possible to use a Repeater in module configuration? I can add one to getInputFields(), like so:

// Source Repeater
$field = wire('modules')->get("InputfieldRepeater");
$field->columnWidth = 100;
$field->attr("id+name", "source_repeater");
$field->label = "Source Text";
$field->icon = "fa-align-left";

But I am at a loss as how to configure the Repeater further. For instance, I've tried making an instance of another fieldtype (FieldtypeText) and adding it to the repeater through code. I want to allow the user to add new entries in this repeater, but want to configure the Repeater field itself entirely through code. I want the admin to be able to add new Repeater items and fill them in. The module should decide what fields to use in the Repeater. When I add the Repeater code above to a wrapper it throws an error, I guess because it needs some fields or further configuration in order to be rendered.

  1. Is it absolutely required that I create fields, for instance in the install method of the module, or can I create them on the fly in getInputFields() somehow?
  2. How and where should I define the fields of this repeater? 

Thank you for your time!

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...