Hi all
Thanks for help.
I am have ACF builder, and he looks like this
<?php
namespace App;
use StoutLogic\AcfBuilder\FieldsBuilder;
$footer = new FieldsBuilder('footer');
$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'])
->addRadio('text_choice')
->addChoices(['text' => 'Text'], ['email' => 'Email'], ['phone' => 'Phone'])
->addText('info_blocks_text')
->conditional('text_choice', '==', 'text')
->addText('info_blocks_email')
->conditional('text_choice', '==', 'email')
->addText('info_blocks_phone')
->conditional('text_choice', '==', 'phone')
->endRepeater()
->endRepeater()
->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 = [];
if($footerInfoBlocks):
foreach ($footerInfoBlocks as $footerInfoBlock):
$this_block = (object)[
'info_blocks_title' => $footerInfoBlock['info_blocks_title'],
'footer_info_text' => $footerInfoBlock['footer_info_text']
];
$data[] = $this_block;
endforeach;
endif;
return $data;
}
and in blade
@foreach ($footer_info_blocks as $footer_info_block)
{{ $footer_info_block->info_blocks_title }}
@endforeach