Code Duplication    Length = 16-23 lines in 3 locations

includes/acf/admin/updates/5.0.0.php 1 location

@@ 286-301 (lines=16) @@
283
				
284
				
285
				// save sub fields
286
				if( !empty($sub_fields) ) {
287
					
288
					$keys = array_keys($sub_fields);
289
					
290
					foreach( $keys as $key ) {
291
					
292
						$sub_field = acf_extract_var($sub_fields, $key);
293
						$sub_field['parent'] = $field['ID'];
294
						$sub_field['parent_layout'] = $layout_key;
295
						
296
						_migrate_field_500( $sub_field );
297
						
298
					}
299
					// foreach
300
					
301
				}
302
				// if
303
				
304
				

includes/acf/fields/page_link.php 1 location

@@ 471-493 (lines=23) @@
468
			
469
			
470
			// set choices
471
			if( !empty($posts) ) {
472
				
473
				foreach( array_keys($posts) as $i ) {
474
					
475
					// vars
476
					$post = acf_extract_var( $posts, $i );
477
					
478
					
479
					if( is_object($post) ) {
480
						
481
						// append to choices
482
						$field['choices'][ $post->ID ] = $this->get_post_title( $post, $field );
483
					
484
					} else {
485
						
486
						// append to choices
487
						$field['choices'][ $post ] = $post;
488
												
489
					}
490
					
491
				}
492
				
493
			}
494
			
495
		}
496
		

includes/acf/pro/acf-pro.php 1 location

@@ 350-369 (lines=20) @@
347
					
348
					
349
					// validate sub fields
350
					if( !empty($sub_fields) ) {
351
						
352
						// loop over sub fields
353
						foreach( array_keys($sub_fields) as $j ) {
354
							
355
							// extract sub field
356
							$sub_field = acf_extract_var( $sub_fields, $j );
357
							
358
							
359
							// attributes
360
							$sub_field['parent'] = $field['key'];
361
							$sub_field['parent_layout'] = $layout['key'];
362
							
363
							
364
							// append to extra
365
							$extra[] = $sub_field;
366
							
367
						}
368
						
369
					}
370
					
371
					
372
					// append to layout