Support

Account

Home Forums Add-ons Repeater Field ACF select outputs 'array'

Unread

ACF select outputs 'array'

    • Jochem

    • November 12, 2018 at 8:36 pm

    Hi, I’m trying to get the label and value of an select option but the output says ‘array’. I followed up some code from the acf website, but it’s not working for me.

    This is my code. (the @acf repeater is from the blade engine plugin)

    I want to show the value from $activitySelect in the li.single-event and the label in the a em.event-name. but the output show ‘array’

    <ul  class="d-md-flex">
    			@acfrepeater('timetables',option)
    			<?php $day = get_sub_field('day');  ?>
    			<li class="events-group flex-fill">
    
    				<div class="top-info"><span>{{$day}}</span></div>
    				<ul>
    					@acfrepeater('timetable',option)
    					<?php 
    
    						$activitySelect = get_sub_field_object('activity');
    						$value = $activitySelect['value'];
    						$label = $activitySelect['label'];
    						// $activity = get_sub_field('activity'); 
    						// $day = get_sub_field('day'); 
    						$start = get_sub_field('start'); 
    						$end = get_sub_field('end'); 
    					?>
    					<li class="single-event" data-start="{{$start}}" data-end="{{$end}}" data-content="event-abs-circuit" data-event="{{$label}}">
    						<a href="#0">
    							<em class="event-name">{{$value}}</em>
    						</a>
    					</li>
    					@acfend
    				</ul>
    			</li>
    			@acfend
    		</ul>
    

    My settings in the repeater field is on show both label and value.

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.