Code Duplication    Length = 20-23 lines in 2 locations

includes/acf/fields/relationship.php 1 location

@@ 843-865 (lines=23) @@
840
	*  @return	$post_id (int)
841
	*/
842
	
843
	function validate_value( $valid, $value, $field, $input ){
844
		
845
		// default
846
		if( empty($value) || !is_array($value) ) {
847
		
848
			$value = array();
849
			
850
		}
851
		
852
		
853
		// min
854
		if( count($value) < $field['min'] ) {
855
		
856
			$valid = _n( '%s requires at least %s selection', '%s requires at least %s selections', $field['min'], 'acf' );
857
			$valid = sprintf( $valid, $field['label'], $field['min'] );
858
			
859
		}
860
		
861
		
862
		// return		
863
		return $valid;
864
		
865
	}
866
		
867
	
868
	/*

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

@@ 806-825 (lines=20) @@
803
	*  @return	$post_id (int)
804
	*/
805
	
806
	function validate_value( $valid, $value, $field, $input ){
807
		
808
		if( empty($value) || !is_array($value) ) {
809
		
810
			$value = array();
811
			
812
		}
813
		
814
		
815
		if( count($value) < $field['min'] ) {
816
		
817
			$valid = _n( '%s requires at least %s selection', '%s requires at least %s selections', $field['min'], 'acf' );
818
			$valid = sprintf( $valid, $field['label'], $field['min'] );
819
			
820
		}
821
		
822
				
823
		return $valid;
824
		
825
	}
826
827
	
828
}