PluginProbe ʕ •ᴥ•ʔ
Secure Custom Fields / 6.9.1
Secure Custom Fields v6.9.1
6.9.1 6.9.0 6.8.9 6.8.7 6.8.8 6.8.6 6.8.4 6.8.5 trunk 6.4.0-beta1 6.4.0-beta2 6.4.1 6.4.1-beta3 6.4.1-beta4 6.4.1-beta5 6.4.1-beta6 6.4.1-beta7 6.4.2 6.5.0 6.5.1 6.5.2 6.5.3 6.5.4 6.5.5 6.5.6 6.5.7 6.6.0 6.7.0 6.7.1 6.8.0 6.8.1 6.8.2 6.8.3
secure-custom-fields / includes / fields / class-acf-field-tab.php
secure-custom-fields / includes / fields Last commit date
FlexibleContent 2 months ago class-acf-field-accordion.php 2 months ago class-acf-field-button-group.php 2 months ago class-acf-field-checkbox.php 2 days ago class-acf-field-clone.php 2 months ago class-acf-field-color_picker.php 2 months ago class-acf-field-date_picker.php 2 months ago class-acf-field-date_time_picker.php 2 months ago class-acf-field-email.php 2 months ago class-acf-field-file.php 2 months ago class-acf-field-flexible-content.php 1 week ago class-acf-field-gallery.php 3 weeks ago class-acf-field-google-map.php 2 months ago class-acf-field-group.php 2 months ago class-acf-field-icon_picker.php 7 months ago class-acf-field-image.php 2 months ago class-acf-field-link.php 2 months ago class-acf-field-message.php 1 year ago class-acf-field-nav-menu.php 1 week ago class-acf-field-number.php 2 months ago class-acf-field-oembed.php 3 weeks ago class-acf-field-output.php 1 year ago class-acf-field-page_link.php 3 weeks ago class-acf-field-password.php 2 months ago class-acf-field-post_object.php 3 weeks ago class-acf-field-radio.php 2 days ago class-acf-field-range.php 2 months ago class-acf-field-relationship.php 3 weeks ago class-acf-field-repeater.php 3 weeks ago class-acf-field-select.php 2 days ago class-acf-field-separator.php 1 year ago class-acf-field-tab.php 1 year ago class-acf-field-taxonomy.php 3 weeks ago class-acf-field-text.php 3 weeks ago class-acf-field-textarea.php 3 weeks ago class-acf-field-time_picker.php 2 months ago class-acf-field-true_false.php 2 months ago class-acf-field-url.php 3 weeks ago class-acf-field-user.php 3 weeks ago class-acf-field-wysiwyg.php 2 months ago class-acf-field.php 2 months ago class-acf-repeater-table.php 1 year ago index.php 1 year ago
class-acf-field-tab.php
168 lines
1 <?php
2
3 if ( ! class_exists( 'acf_field_tab' ) ) :
4
5 class acf_field_tab extends acf_field {
6
7 public $show_in_rest = false;
8
9 /**
10 * This function will setup the field type data
11 *
12 * @type function
13 * @date 5/03/2014
14 * @since ACF 5.0.0
15 *
16 * @param n/a
17 * @return n/a
18 */
19 function initialize() {
20
21 // vars
22 $this->name = 'tab';
23 $this->label = __( 'Tab', 'secure-custom-fields' );
24 $this->category = 'layout';
25 $this->description = __( 'Allows you to group fields into tabbed sections in the edit screen. Useful for keeping fields organized and structured.', 'secure-custom-fields' );
26 $this->preview_image = acf_get_url() . '/assets/images/field-type-previews/field-preview-tabs.png';
27 $this->doc_url = 'https://developer.wordpress.org/secure-custom-fields/features/fields/tab/';
28 $this->tutorial_url = 'https://developer.wordpress.org/secure-custom-fields/features/fields/tab/tab-tutorial/';
29 $this->supports = array(
30 'required' => false,
31 'bindings' => false,
32 );
33 $this->defaults = array(
34 'placement' => 'top',
35 'endpoint' => 0, // added in 5.2.8
36 'selected' => 0, // added in 6.3
37 );
38 }
39
40 /**
41 * Output the HTML required for a tab.
42 *
43 * @since ACF 3.6
44 *
45 * @param array $field An array of the field data.
46 */
47 public function render_field( $field ) {
48 $atts = array(
49 'href' => '',
50 'class' => 'acf-tab-button',
51 'data-placement' => $field['placement'],
52 'data-endpoint' => $field['endpoint'],
53 'data-key' => $field['key'],
54 'data-selected' => $field['selected'],
55 );
56
57 if ( isset( $field['unique_tab_key'] ) && ! empty( $field['unique_tab_key'] ) ) {
58 $atts['data-unique-tab-key'] = $field['unique_tab_key'];
59 }
60
61 if ( isset( $field['settings-type'] ) ) {
62 $atts['data-settings-type'] = acf_slugify( $field['settings-type'] );
63 $atts['class'] .= ' acf-settings-type-' . acf_slugify( $field['settings-type'] );
64 }
65
66 if ( isset( $field['class'] ) && ! empty( $field['class'] ) ) {
67 $atts['class'] .= ' ' . $field['class'];
68 }
69
70 ?>
71 <a <?php echo acf_esc_attrs( $atts ); ?>><?php echo acf_esc_html( $field['label'] ); ?></a>
72 <?php
73 }
74
75 /**
76 * Create extra options for your field. This is rendered when editing a field.
77 * The value of $field['name'] can be used (like bellow) to save extra data to the $field
78 *
79 * @param $field - an array holding all the field's data
80 *
81 * @type action
82 * @since ACF 3.6
83 * @date 23/01/13
84 */
85 function render_field_settings( $field ) {
86
87 /*
88 // message
89 $message = '';
90 $message .= '<p>' . __( 'Use "Tab Fields" to better organize your edit screen by grouping fields together.', 'secure-custom-fields') . '</p>';
91 $message .= '<p>' . __( 'All fields following this "tab field" (or until another "tab field" is defined) will be grouped together using this field\'s label as the tab heading.','secure-custom-fields') . '</p>';
92
93
94 // default_value
95 acf_render_field_setting( $field, array(
96 'label' => __('Instructions','secure-custom-fields'),
97 'instructions' => '',
98 'name' => 'notes',
99 'type' => 'message',
100 'message' => $message,
101 ));
102 */
103
104 // preview_size
105 acf_render_field_setting(
106 $field,
107 array(
108 'label' => __( 'Placement', 'secure-custom-fields' ),
109 'type' => 'select',
110 'name' => 'placement',
111 'choices' => array(
112 'top' => __( 'Top aligned', 'secure-custom-fields' ),
113 'left' => __( 'Left aligned', 'secure-custom-fields' ),
114 ),
115 )
116 );
117
118 // endpoint
119 acf_render_field_setting(
120 $field,
121 array(
122 'label' => __( 'New Tab Group', 'secure-custom-fields' ),
123 'instructions' => __( 'Start a new group of tabs at this tab.', 'secure-custom-fields' ),
124 'name' => 'endpoint',
125 'type' => 'true_false',
126 'ui' => 1,
127 )
128 );
129 }
130
131
132 /**
133 * This filter is applied to the $field after it is loaded from the database
134 *
135 * @type filter
136 * @since ACF 3.6
137 * @date 23/01/13
138 *
139 * @param $field - the field array holding all the field options
140 *
141 * @return $field - the field array holding all the field options
142 */
143 function load_field( $field ) {
144
145 // remove name to avoid caching issue
146 $field['name'] = '';
147
148 // remove instructions
149 $field['instructions'] = '';
150
151 // remove required to avoid JS issues
152 $field['required'] = 0;
153
154 // set value other than 'null' to avoid ACF loading / caching issue
155 $field['value'] = false;
156
157 // return
158 return $field;
159 }
160 }
161
162
163 // initialize
164 acf_register_field_type( 'acf_field_tab' );
165 endif; // class_exists check
166
167 ?>
168