Custom List Field within Builder Plugin

panel
field
panelfield

#1

Hi,
I am using the kirby builder plugin https://github.com/TimOetting/kirby-builder
and I want to include the list field https://github.com/TimOetting/kirby-list-field.
My issue is, that I only can add one item.

My code looks like this for the module:

<div class="section">
	<p class="sectionHeader sans-xs-b"><?= $data->moduleintro()->kt() ?></p>
	<ul class="sectionList sans-xs">
		<?php foreach($data->modulelist()->toStructure() as $term): ?>
			<li><?= $data->modulelist($term) ?></li>
	  	<?php endforeach ?>
	</ul>
</div>

So maybe anyone has an idea how to solve this.

Thanks for any help :pray:


#2

I’d love to help you but I don’t understand what exactly does not work as expected. What is $data what is the modulelist field. What has the code to do with the fact that you can only add one item (in the Panel, I guess?).

Please also post your blueprint.


#3

Sorry for this.

The custom list module displays only one input field (of the list) in the builder module. That means I can’t really create a list. I think it’s because of the builder plugin and I didn’t integrate it properly.

my blueprint looks like this:

  builder:
    label: Sections
    type: builder
    fieldsets:
      listModule:
        label: ListModule
        snippet: sections/listmodule
        fields:
	        moduleintro:
	            label: Intro Text
	            type: textarea
	        modulelist:
			    label: Services
			    type: list

#4

Should work, though. Once you add an item, a new input field should appear.

Make sure that your indentation is correct and better use spaces then tabs. Looks like you have mixed tabs and spaces and the indentation is also not correct if I copy the above code into a blueprint.


#5

okay. The problem was that the indentation wasnt correct.
Thanks again @texnixe !!