Code Duplication    Length = 38-39 lines in 2 locations

docs/examples/user/_starter.php 1 location

@@ 7-45 (lines=39) @@
4
 *
5
 * @param WP_Fields_API $wp_fields
6
 */
7
function example_my_user_starter( $wp_fields ) {
8
9
	// Object type: User
10
	$object_type = 'user';
11
12
	// Object name: n/a
13
	$object_name = null;
14
15
	// Form: User Edit Profile
16
	$form_id = 'user-edit';
17
18
	/////////////////////////
19
	// Section: My Section //
20
	/////////////////////////
21
22
	$section_id   = ''; // @todo Fill in section ID
23
	$section_args = array(
24
		'title' => __( '', 'my-text-domain' ), // @todo Fill in section heading, update text domain
25
		'form'  => $form_id,
26
	);
27
28
	$wp_fields->add_section( $object_type, $section_id, $object_name, $section_args );
29
30
	// My Field
31
	$field_id   = '';
32
	$field_args = array(
33
		// You can register a control for this field at the same time
34
		'control' => array(
35
			'type'        => 'text', // @todo Change control type if needed
36
			'section'     => $section_id,
37
			'label'       => __( '', 'my-text-domain' ), // @todo Fill in label, update text domain
38
			'description' => __( '', 'my-text-domain' ), // @todo Fill in description, update text domain
39
		),
40
	);
41
42
	$wp_fields->add_field( $object_type, $field_id, $object_name, $field_args );
43
44
}
45
46
add_action( 'fields_register', 'example_my_user_starter' );

docs/examples/term/_starter.php 1 location

@@ 7-44 (lines=38) @@
4
 *
5
 * @param WP_Fields_API $wp_fields
6
 */
7
function example_my_term_starter( $wp_fields ) {
8
9
	// Object type: Term
10
	$object_type = 'term';
11
12
	// Object name: Category
13
	$object_name = 'category'; // @todo Change to any taxonomy name
14
15
	// Form: Term Edit
16
	$form_id = 'term-edit'; // @todo Also available is term-add
17
18
	/////////////////////////
19
	// Section: My Section //
20
	/////////////////////////
21
22
	$section_id   = ''; // @todo Fill in section ID
23
	$section_args = array(
24
		'title' => __( '', 'my-text-domain' ), // @todo Fill in section heading, update text domain
25
		'form'  => $form_id,
26
	);
27
28
	$wp_fields->add_section( $object_type, $section_id, $object_name, $section_args );
29
30
	// My Field
31
	$field_id   = '';
32
	$field_args = array(
33
		// You can register a control for this field at the same time
34
		'control' => array(
35
			'type'        => 'text', // @todo Change control type if needed
36
			'section'     => $section_id,
37
			'label'       => __( '', 'my-text-domain' ), // @todo Fill in label, update text domain
38
			'description' => __( '', 'my-text-domain' ), // @todo Fill in description, update text domain
39
		),
40
	);
41
42
	$wp_fields->add_field( $object_type, $field_id, $object_name, $field_args );
43
44
}
45
46
add_action( 'fields_register', 'example_my_term_starter' );