PluginProbe
Adminify – White Label, Admin Menu Editor, Login Customizer / 3.2.2
Adminify – White Label, Admin Menu Editor, Login Customizer v3.2.2
4.3.1 4.3.0 4.2.26 4.2.25 4.2.24 4.2.23 4.2.22 4.2.21 4.2.20 4.2.19 4.2.18 4.2.17 4.2.16 4.2.15 4.2.14 4.2.13 4.2.12 4.2.11 4.2.10 4.2.9 4.2.8 4.2.7 4.2.6 4.2.5 4.1.17 All 164 releases
adminify / Inc / Admin / Options / Module_Folders.php

Module_Folders.php in Adminify – White Label, Admin Menu Editor, Login Customizer 3.2.2, at Inc/Admin/Options/Module_Folders.php

125 lines 4.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace WPAdminify\Inc\Admin\Options;
4
5 use WPAdminify\Inc\Utils ;
6 use WPAdminify\Inc\Admin\AdminSettingsModel ;
7 if ( !defined( 'ABSPATH' ) ) {
8 die;
9 }
10 // Cannot access directly.
11 if ( !class_exists( 'Module_Folders' ) ) {
12 class Module_Folders extends AdminSettingsModel
13 {
14 public function __construct()
15 {
16 $this->folders_settings();
17 }
18
19 public function get_defaults()
20 {
21 return [
22 'folders_user_roles' => [],
23 'folders_enable_for' => [ 'post', 'page' ],
24 'folders_media' => true,
25 ];
26 }
27
28 /**
29 * User Roles
30 */
31 public function folders_user_roles( &$fields )
32 {
33 $fields[] = [
34 'type' => 'subheading',
35 'content' => Utils::adminfiy_help_urls(
36 __( 'Folders Settings', 'adminify' ),
37 'https://wpadminify.com/kb/organize-media-library-pages-posts-post-type-using-folder/',
38 'https://www.youtube.com/playlist?list=PLqpMw0NsHXV-EKj9Xm1DMGa6FGniHHly8',
39 'https://www.facebook.com/groups/jeweltheme',
40 'https://wpadminify.com/support/folders/'
41 ),
42 ];
43 $fields[] = [
44 'id' => 'folders_user_roles',
45 'type' => 'select',
46 'title' => __( 'Disable for', 'adminify' ),
47 'placeholder' => __( 'Select User roles you want to show', 'adminify' ),
48 'options' => 'roles',
49 'multiple' => true,
50 'chosen' => true,
51 'default' => $this->get_default_field( 'folders_user_roles' ),
52 ];
53 $fields[] = [
54 'id' => 'folders_enable_for',
55 'type' => 'checkbox',
56 'title' => __( 'Enable Folders for', 'adminify' ),
57 'subtitle' => __( 'Select Post Types for enabling Folders Module', 'adminify' ),
58 'options' => 'post_types',
59 'query_args' => [
60 'orderby' => 'post_title',
61 'order' => 'ASC',
62 ],
63 'default' => $this->get_default_field( 'folders_enable_for' ),
64 ];
65 $fields[] = [
66 'type' => 'notice',
67 'style' => 'warning',
68 'content' => Utils::adminify_upgrade_pro(),
69 'dependency' => [ [
70 'folders_enable_for',
71 'not-any',
72 'post,page',
73 'true'
74 ], [
75 'folders_enable_for',
76 '!=',
77 '',
78 'true'
79 ] ],
80 ];
81 }
82
83 /**
84 * Media Elements Sortable
85 *
86 * @return void
87 */
88 public function folders_for_media( &$fields )
89 {
90 $fields[] = [
91 'id' => 'folders_media',
92 'type' => 'switcher',
93 'title' => __( 'Enable for Media', 'adminify' ),
94 'text_on' => __( 'Enabled', 'adminify' ),
95 'text_off' => __( 'Disabled', 'adminify' ),
96 'text_width' => 100,
97 'default' => $this->get_default_field( 'folders_media' ),
98 ];
99 }
100
101 /**
102 * Module: Folders
103 *
104 * @return void
105 */
106 public function folders_settings()
107 {
108 if ( !class_exists( 'ADMINIFY' ) ) {
109 return;
110 }
111 $fields = [];
112 $this->folders_user_roles( $fields );
113 $this->folders_for_media( $fields );
114 // Folders Order Section
115 \ADMINIFY::createSection( $this->prefix, [
116 'title' => __( 'Folders', 'adminify' ),
117 'id' => 'module_folders_section',
118 'parent' => 'module_settings',
119 'icon' => 'far fa-folder-open',
120 'fields' => $fields,
121 ] );
122 }
123
124 }
125 }