PluginProbe
Adminify – White Label, Admin Menu Editor, Login Customizer / 3.2.4.5
Adminify – White Label, Admin Menu Editor, Login Customizer v3.2.4.5
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.4.5, at Inc/Admin/Options/Module_Folders.php

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