class-learndash-admin-binary-selector-user-courses.php
1.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php
/**
* LearnDash Binary Selector User Courses.
*
* @since 2.2.1
* @package LearnDash\Settings
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ( ! class_exists( 'Learndash_Binary_Selector_User_Courses' ) ) && ( class_exists( 'Learndash_Binary_Selector_Posts' ) ) ) {
/**
* Class LearnDash Binary Selector User Courses.
*
* @since 2.2.1
* @uses Learndash_Binary_Selector_Posts
*/
class Learndash_Binary_Selector_User_Courses extends Learndash_Binary_Selector_Posts {
/**
* Public constructor for class
*
* @since 2.2.1
*
* @param array $args Array of arguments for class.
*/
public function __construct( $args = array() ) {
$this->selector_class = get_class( $this );
$defaults = array(
'user_id' => 0,
'post_type' => 'sfwd-courses',
'html_title' => '<h3>' . sprintf(
// translators: placeholder: Courses.
esc_html_x( 'User Enrolled in %s', 'User Enrolled in Courses Label', 'learndash' ),
LearnDash_Custom_Label::get_label( 'courses' )
) . '</h3>',
'html_id' => 'learndash_user_courses',
'html_class' => 'learndash_user_courses',
'html_name' => 'learndash_user_courses',
'search_label_left' => sprintf(
// translators: placeholder: Courses.
esc_html_x( 'Search All %s', 'Search All Courses Label', 'learndash' ),
LearnDash_Custom_Label::get_label( 'courses' )
),
'search_label_right' => sprintf(
// translators: placeholder: Courses.
esc_html_x( 'Search Enrolled %s', 'Search Enrolled Courses Label', 'learndash' ),
LearnDash_Custom_Label::get_label( 'courses' )
),
);
$args = wp_parse_args( $args, $defaults );
$args['html_id'] = $args['html_id'] . '-' . $args['user_id'];
$args['html_name'] = $args['html_name'] . '[' . $args['user_id'] . ']';
parent::__construct( $args );
}
}
}