Code Duplication    Length = 18-18 lines in 2 locations

includes/class-give-html-elements.php 2 locations

@@ 251-268 (lines=18) @@
248
	 *
249
	 * @return string           Categories dropdown.
250
	 */
251
	public function category_dropdown( $name = 'give_forms_categories', $selected = 0, $args = array() ) {
252
		$categories = get_terms( 'give_forms_category', apply_filters( 'give_forms_category_dropdown', array() ) );
253
		$options    = array();
254
255
		foreach ( $categories as $category ) {
256
			$options[ absint( $category->term_id ) ] = esc_html( $category->name );
257
		}
258
259
		$output = $this->select( wp_parse_args( $args, array(
260
			'name'             => $name,
261
			'selected'         => $selected,
262
			'options'          => $options,
263
			'show_option_all'  => esc_html__( 'All Categories', 'give' ),
264
			'show_option_none' => false,
265
		) ) );
266
267
		return $output;
268
	}
269
270
	/**
271
	 * Tags Dropdown
@@ 284-301 (lines=18) @@
281
	 *
282
	 * @return string           Tags dropdown.
283
	 */
284
	public function tags_dropdown( $name = 'give_forms_tags', $selected = 0, $args = array() ) {
285
		$tags    = get_terms( 'give_forms_tag', apply_filters( 'give_forms_tag_dropdown', array() ) );
286
		$options = array();
287
288
		foreach ( $tags as $tag ) {
289
			$options[ absint( $tag->term_id ) ] = esc_html( $tag->name );
290
		}
291
292
		$output = $this->select( wp_parse_args( $args, array(
293
			'name'             => $name,
294
			'selected'         => $selected,
295
			'options'          => $options,
296
			'show_option_all'  => esc_html__( 'All Tags', 'give' ),
297
			'show_option_none' => false,
298
		) ) );
299
300
		return $output;
301
	}
302
303
	/**
304
	 * Years Dropdown