Roots Discourse

Repeater in repeater and choice conditional logic field

Hi all
Thanks for help.

I am have ACF builder, and he looks like this


namespace App;

use StoutLogic\AcfBuilder\FieldsBuilder;

$footer = new FieldsBuilder('footer');

	->addTab('Footer settings', ['placement' => 'left'])
	->addRepeater('footer_info_blocks', ['min' => 1, 'max' => 3, 'label' => 'Info blocks', 'layout' => 'row', 'button_label' => 'Add info block'])
		->addText('info_blocks_title', [
		'label' => 'Info block title',
		->addRepeater('footer_info_text', ['min' => 1, 'max' => 3, 'layout' => 'row', 'button_label' => 'Add text'])
				->addChoices(['text' => 'Text'], ['email' => 'Email'], ['phone' => 'Phone'])
				->conditional('text_choice', '==', 'text')
				->conditional('text_choice', '==', 'email')
				->conditional('text_choice', '==', 'phone')

	->addImage('footer_logo', ['label' => 'Footer logo', 'return_format' => 'array', 'preview_size' => 'thumbnail',]);

return $footer;

I don’t understand how to get the field repeater ‘footer_info_text’ in main repeater ‘footer_info_blocks’, and then get radio field ‘text_choice’ with conditional logic other fields ‘info_blocks_text’ etc.

Here is my code in Controller

public function footerInfoBlocks()
			$footerInfoBlocks = get_field('footer_info_blocks', pll_current_language());

			$data = [];

				foreach ($footerInfoBlocks as $footerInfoBlock):
					$this_block = (object)[
						'info_blocks_title' => $footerInfoBlock['info_blocks_title'],
						'footer_info_text' => $footerInfoBlock['footer_info_text']
					$data[] = $this_block;

			return $data;

and in blade

@foreach ($footer_info_blocks as $footer_info_block)

		{{ $footer_info_block->info_blocks_title }}


This topic was automatically closed after 42 days. New replies are no longer allowed.