PluginProbe
Easy Elements for Elementor – Addons & Website Templates / 1.2.7
Easy Elements for Elementor – Addons & Website Templates v1.2.7
1.5.3 1.5.2 1.5.1 1.5.0 1.4.9 1.4.6 1.4.7 1.4.8 1.4.5 1.4.4 1.4.3 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 All 47 releases
easy-elements / includes / Admin / settingstab / tab-userData.php

tab-userData.php in Easy Elements for Elementor – Addons & Website Templates 1.2.7, at includes/Admin/settingstab/tab-userData.php

103 lines 4.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
3
4 $tab_slug = isset($current_tab) ? $current_tab : 'user_data';
5
6
7 // assume this file is in the plugin root and fields/ is sibling
8 include EASYELEMENTS_DIR_PATH . "includes/Admin/settings-framework/init.php";
9 $fields_dir = __DIR__ . '../settings-framework/fields';
10
11 $fm = new Easyel_FieldManager($fields_dir);
12
13
14 $settings = get_option('easy_element_user_data', []);
15 $settings_sections = [
16 [
17 'id' => 'social_feeds',
18 'label' => 'Social Feeds',
19 ],
20 ];
21 $settings_fields = [
22 [
23 'section_id' => 'social_feeds',
24 'id' => 'fb_config',
25 'name' => 'fb_config',
26 'label' => 'Facebook',
27 'type' => 'fields_group',
28 'options' => [
29 [ 'id' => 'page_id', 'name' => 'page_id', 'type' => 'text', 'default' => '', 'placeholder' => 'Page ID' ],
30 [ 'id' => 'page_access_token', 'name' => 'page_access_token', 'type' => 'text', 'default' => '', 'class' => 'w-100', 'placeholder' => 'Page Access Token' ],
31 ],
32 'value' => !empty($settings['fb_config']) ? $settings['fb_config'] : [],
33 'default' => '',
34 ],
35 [
36 'section_id' => 'social_feeds',
37 'id' => 'insta_config',
38 'name' => 'insta_config',
39 'label' => 'Instagram',
40 'type' => 'fields_group',
41 'options' => [
42 [ 'id' => 'username', 'name' => 'username', 'type' => 'text', 'default' => '', 'placeholder' => 'easy_elements' ],
43 [ 'id' => 'page_access_token', 'name' => 'page_access_token', 'type' => 'text', 'default' => '', 'class' => 'w-100', 'placeholder' => 'Access Token' ],
44 ],
45 'value' => !empty($settings['insta_config']) ? $settings['insta_config'] : [],
46 'default' => '',
47 ],
48 ];
49 ?>
50 <div class="easyel-settings-wrapper">
51 <div class="easyel-settings-topbar">
52 <h3 class="easyel-settings-title"><?php echo esc_html__( 'Settings', 'easy-elements' )?></h3>
53 <div class="easyel-settings-actions">
54 <button type="button" id="easyel-settings-save">Save</button>
55 </div>
56 </div>
57 <form id="easyel-settings-form" class="easyel-settings-wrapper">
58 <div class="easyel-settings-fields">
59 <?php foreach ( $settings_sections as $section ) : ?>
60 <div class="easyel-settings-section" id="section-<?php echo esc_attr($section['id']); ?>">
61 <h3 class="easyel-section-title"><?php echo esc_html( $section['label'] ); ?></h3>
62
63 <?php foreach ( $settings_fields as $field ) :
64 if($field['section_id'] !== $section['id']) continue;
65 ?>
66
67 <?php
68 // Fields Group
69 if ($field['type'] === 'fields_group') {
70 ?>
71 <div class="easyel-settings-field">
72 <div class="easyel-settings-field-label"><?php echo esc_html($field['label']); ?></div>
73 <div class="easyel-settings-field-inputs">
74 <div class="easyel-settings-field-input-wrapper">
75 <?php $fm->render_fields_group($field, $settings); ?>
76 </div>
77 </div>
78 </div>
79 <?php
80 } else {
81
82 // Single Field Support
83 $name = $field['name'];
84 $value = $settings[$name] ?? ($field['default'] ?? '');
85 $field['full_name'] = $name;
86 ?>
87 <div class="easyel-settings-field">
88 <div class="easyel-settings-field-label"><?php echo esc_html($field['label']); ?></div>
89 <div class="easyel-settings-field-inputs">
90 <div class="easyel-settings-field-input-wrapper">
91 <?php $fm->render_field($field, $value, ['name'=>$name, 'settings'=>$settings]); ?>
92 </div>
93 </div>
94 </div>
95 <?php } ?>
96
97 <?php endforeach; ?>
98
99 </div>
100 <?php endforeach; ?>
101 </div>
102 </form>
103 </div>