Passed
Push — main ( 67eb22...ce3ddb )
by TARIQ
01:40
created

Clients_Feature::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 2
rs 10
1
<?php
2
namespace BrightyCorePlugin;
3
4
class Clients_Feature implements Brighty_Core_Plugin_Feature_Interface  {
5
    private $plugin;
6
7
    public function __construct($plugin) {
8
        $this->plugin = $plugin;
9
    }
10
11
    public function init() {
12
        // Register the custom post type 'Invoices'
13
        add_action('init', array($this, 'register_custom_post_type'));
14
    }
15
16
    public function register_custom_post_type() {
17
        $labels = [
18
            'name'                     => esc_html__( 'Clients', 'brighty' ),
19
            'singular_name'            => esc_html__( 'Client', 'brighty' ),
20
            'add_new'                  => esc_html__( 'Add New', 'brighty' ),
21
            'add_new_item'             => esc_html__( 'Add new client', 'brighty' ),
22
            'edit_item'                => esc_html__( 'Edit Client', 'brighty' ),
23
            'new_item'                 => esc_html__( 'New Client', 'brighty' ),
24
            'view_item'                => esc_html__( 'View Client', 'brighty' ),
25
            'view_items'               => esc_html__( 'View Clients', 'brighty' ),
26
            'search_items'             => esc_html__( 'Search Clients', 'brighty' ),
27
            'not_found'                => esc_html__( 'No clients found', 'brighty' ),
28
            'not_found_in_trash'       => esc_html__( 'No clients found in Trash', 'brighty' ),
29
            'parent_item_colon'        => esc_html__( 'Parent Client:', 'brighty' ),
30
            'all_items'                => esc_html__( 'All Clients', 'brighty' ),
31
            'archives'                 => esc_html__( 'Client Archives', 'brighty' ),
32
            'attributes'               => esc_html__( 'Client Attributes', 'brighty' ),
33
            'insert_into_item'         => esc_html__( 'Insert into client', 'brighty' ),
34
            'uploaded_to_this_item'    => esc_html__( 'Uploaded to this client', 'brighty' ),
35
            'featured_image'           => esc_html__( 'Featured image', 'brighty' ),
36
            'set_featured_image'       => esc_html__( 'Set featured image', 'brighty' ),
37
            'remove_featured_image'    => esc_html__( 'Remove featured image', 'brighty' ),
38
            'use_featured_image'       => esc_html__( 'Use as featured image', 'brighty' ),
39
            'menu_name'                => esc_html__( 'Clients', 'brighty' ),
40
            'filter_items_list'        => esc_html__( 'Filter clients list', 'brighty' ),
41
            'filter_by_date'           => esc_html__( '', 'brighty' ),
42
            'items_list_navigation'    => esc_html__( 'Clients list navigation', 'brighty' ),
43
            'items_list'               => esc_html__( 'Clients list', 'brighty' ),
44
            'item_published'           => esc_html__( 'Client published', 'brighty' ),
45
            'item_published_privately' => esc_html__( 'Client published privately', 'brighty' ),
46
            'item_reverted_to_draft'   => esc_html__( 'Client reverted to draft', 'brighty' ),
47
            'item_scheduled'           => esc_html__( 'Client scheduled', 'brighty' ),
48
            'item_updated'             => esc_html__( 'Client updated', 'brighty' ),
49
            'text_domain'              => esc_html__( 'brighty', 'brighty' ),
50
        ];
51
        $args = [
52
            'label'               => esc_html__( 'Clients', 'brighty' ),
53
            'labels'              => $labels,
54
            'description'         => '',
55
            'public'              => true,
56
            'hierarchical'        => false,
57
            'exclude_from_search' => false,
58
            'publicly_queryable'  => true,
59
            'show_ui'             => true,
60
            'show_in_nav_menus'   => true,
61
            'show_in_admin_bar'   => true,
62
            'show_in_rest'        => true,
63
            'query_var'           => true,
64
            'can_export'          => true,
65
            'delete_with_user'    => true,
66
            'has_archive'         => true,
67
            'rest_base'           => '',
68
            'show_in_menu'        => true,
69
            'menu_position'       => '',
70
            'menu_icon'           => 'dashicons-building',
71
            'capability_type'     => 'post',
72
            'supports'            => ['title', 'comments', 'revisions'],
73
            'taxonomies'          => [],
74
            'rewrite'             => [
75
                'with_front' => false,
76
            ],
77
        ];
78
    
79
    
80
81
        // Register the 'Clients' custom post type
82
        register_post_type('client', $args);
83
    }
84
}
85
86