Code Duplication    Length = 3-4 lines in 2 locations

includes/admin/shortcodes/abstract-shortcode-generator.php 1 location

@@ 295-297 (lines=3) @@
292
		$options = array();
293
294
		if ( $posts ) {
295
			foreach ( $posts as $post ) {
296
				$options[ absint( $post->ID ) ] = ( empty( $post->post_title ) ? sprintf( __( 'Untitled (#%s)', 'give' ), $post->ID ) : $post->post_title );
297
			}
298
299
			$field['type']    = 'listbox';
300
			$field['options'] = $options;

includes/class-give-html-elements.php 1 location

@@ 136-139 (lines=4) @@
133
134
		if ( $forms ) {
135
			$options[0] = $args['placeholder'];
136
			foreach ( $forms as $form ) {
137
				$form_title                     = empty( $form->post_title ) ? sprintf( __( 'Untitled (#%s)', 'give' ), $form->ID ) : $form->post_title;
138
				$options[ absint( $form->ID ) ] = esc_html( $form_title );
139
			}
140
		} else {
141
			$options[0] = esc_html__( 'No forms found.', 'give' );
142
		}