Code Duplication    Length = 41-42 lines in 2 locations

includes/acf/pro/fields/flexible-content.php 1 location

@@ 368-408 (lines=41) @@
365
	
366
<?php if( !empty($layout['sub_fields']) ): ?>
367
	
368
	<?php if( $layout['display'] == 'table' ): 
369
		
370
		// update vars
371
		$el = 'td';
372
		
373
		?>
374
	<table class="acf-table">
375
		
376
		<thead>
377
			<tr>
378
				<?php foreach( $layout['sub_fields'] as $sub_field ): 
379
					
380
					$atts = array(
381
						'class'		=> "acf-th acf-th-{$sub_field['name']}",
382
						'data-key'	=> $sub_field['key'],
383
					);
384
					
385
					
386
					// Add custom width
387
					if( $sub_field['wrapper']['width'] ) {
388
					
389
						$atts['data-width'] = $sub_field['wrapper']['width'];
390
						
391
					}
392
						
393
					?>
394
					<th <?php acf_esc_attr_e( $atts ); ?>>
395
						<?php echo acf_get_field_label( $sub_field ); ?>
396
						<?php if( $sub_field['instructions'] ): ?>
397
							<p class="description"><?php echo $sub_field['instructions']; ?></p>
398
						<?php endif; ?>
399
					</th>
400
					
401
				<?php endforeach; ?> 
402
			</tr>
403
		</thead>
404
		
405
		<tbody>
406
	<?php else: ?>
407
	<div class="acf-fields <?php if($layout['display'] == 'row'): ?>-left<?php endif; ?>">
408
	<?php endif; ?>
409
	
410
		<?php
411
			

includes/acf/pro/fields/repeater.php 1 location

@@ 248-289 (lines=42) @@
245
<div <?php acf_esc_attr_e($div); ?>>
246
<table class="acf-table">
247
	
248
	<?php if( $field['layout'] == 'table' ): ?>
249
		<thead>
250
			<tr>
251
				<?php if( $show_order ): ?>
252
					<th class="acf-row-handle"><span></span></th>
253
				<?php endif; ?>
254
				
255
				<?php foreach( $field['sub_fields'] as $sub_field ): 
256
					
257
					$atts = array(
258
						'class'		=> 'acf-th',
259
						'data-key'	=> $sub_field['key'],
260
					);
261
					
262
					
263
					// add type
264
					$atts['class'] .= ' acf-th-' . $sub_field['type'];
265
					
266
					
267
					// Add custom width
268
					if( $sub_field['wrapper']['width'] ) {
269
					
270
						$atts['data-width'] = $sub_field['wrapper']['width'];
271
						
272
					}
273
						
274
					?>
275
					<th <?php acf_esc_attr_e( $atts ); ?>>
276
						<?php echo acf_get_field_label( $sub_field ); ?>
277
						<?php if( $sub_field['instructions'] ): ?>
278
							<p class="description"><?php echo $sub_field['instructions']; ?></p>
279
						<?php endif; ?>
280
					</th>
281
					
282
				<?php endforeach; ?>
283
284
				<?php if( $show_remove ): ?>
285
					<th class="acf-row-handle"><span></span></th>
286
				<?php endif; ?>
287
			</tr>
288
		</thead>
289
	<?php endif; ?>
290
	
291
	<tbody>
292
		<?php foreach( $field['value'] as $i => $row ):