PluginProbe ʕ •ᴥ•ʔ
Secure Custom Fields / 6.4.0-beta2
Secure Custom Fields v6.4.0-beta2
6.9.5 6.9.4 6.9.3 6.9.2 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-accordion.php
secure-custom-fields / includes / fields Last commit date
class-acf-field-accordion.php 1 year ago class-acf-field-button-group.php 1 year ago class-acf-field-checkbox.php 1 year ago class-acf-field-color_picker.php 1 year ago class-acf-field-date_picker.php 1 year ago class-acf-field-date_time_picker.php 1 year ago class-acf-field-email.php 1 year ago class-acf-field-file.php 1 year ago class-acf-field-google-map.php 1 year ago class-acf-field-group.php 1 year ago class-acf-field-icon_picker.php 1 year ago class-acf-field-image.php 1 year ago class-acf-field-link.php 1 year ago class-acf-field-message.php 1 year ago class-acf-field-number.php 1 year ago class-acf-field-oembed.php 1 year ago class-acf-field-output.php 1 year ago class-acf-field-page_link.php 1 year ago class-acf-field-password.php 1 year ago class-acf-field-post_object.php 1 year ago class-acf-field-radio.php 1 year ago class-acf-field-range.php 1 year ago class-acf-field-relationship.php 1 year ago class-acf-field-select.php 1 year ago class-acf-field-separator.php 1 year ago class-acf-field-tab.php 1 year ago class-acf-field-taxonomy.php 1 year ago class-acf-field-text.php 1 year ago class-acf-field-textarea.php 1 year ago class-acf-field-time_picker.php 1 year ago class-acf-field-true_false.php 1 year ago class-acf-field-url.php 1 year ago class-acf-field-user.php 1 year ago class-acf-field-wysiwyg.php 1 year ago class-acf-field.php 1 year ago index.php 1 year ago
class-acf-field-accordion.php
148 lines
1 <?php
2
3 if ( ! class_exists( 'acf_field__accordion' ) ) :
4
5 class acf_field__accordion extends acf_field {
6
7 public $show_in_rest = false;
8
9 /**
10 * initialize
11 *
12 * This function will setup the field type data
13 *
14 * @date 30/10/17
15 * @since 5.6.3
16 *
17 * @param n/a
18 * @return n/a
19 */
20 function initialize() {
21
22 // vars
23 $this->name = 'accordion';
24 $this->label = __( 'Accordion', 'acf' );
25 $this->category = 'layout';
26 $this->description = __( 'Allows you to group and organize custom fields into collapsable panels that are shown while editing content. Useful for keeping large datasets tidy.', 'acf' );
27 $this->preview_image = acf_get_url() . '/assets/images/field-type-previews/field-preview-accordion.png';
28 $this->doc_url = 'https://www.advancedcustomfields.com/resources/accordion/';
29 $this->supports = array(
30 'required' => false,
31 'bindings' => false,
32 );
33 $this->defaults = array(
34 'open' => 0,
35 'multi_expand' => 0,
36 'endpoint' => 0,
37 );
38 }
39
40
41 /**
42 * render_field
43 *
44 * Create the HTML interface for your field
45 *
46 * @date 30/10/17
47 * @since 5.6.3
48 *
49 * @param array $field
50 * @return n/a
51 */
52 function render_field( $field ) {
53
54 // vars
55 $atts = array(
56 'class' => 'acf-fields',
57 'data-open' => $field['open'],
58 'data-multi_expand' => $field['multi_expand'],
59 'data-endpoint' => $field['endpoint'],
60 );
61
62 ?>
63 <div <?php echo acf_esc_attrs( $atts ); ?>></div>
64 <?php
65 }
66
67
68
69 /**
70 * Create extra options for your field. This is rendered when editing a field.
71 * The value of $field['name'] can be used (like bellow) to save extra data to the $field
72 *
73 * @param $field - an array holding all the field's data
74 *
75 * @type action
76 * @since 3.6
77 * @date 23/01/13
78 */
79 function render_field_settings( $field ) {
80 acf_render_field_setting(
81 $field,
82 array(
83 'label' => __( 'Open', 'acf' ),
84 'instructions' => __( 'Display this accordion as open on page load.', 'acf' ),
85 'name' => 'open',
86 'type' => 'true_false',
87 'ui' => 1,
88 )
89 );
90
91 acf_render_field_setting(
92 $field,
93 array(
94 'label' => __( 'Multi-Expand', 'acf' ),
95 'instructions' => __( 'Allow this accordion to open without closing others.', 'acf' ),
96 'name' => 'multi_expand',
97 'type' => 'true_false',
98 'ui' => 1,
99 )
100 );
101
102 acf_render_field_setting(
103 $field,
104 array(
105 'label' => __( 'Endpoint', 'acf' ),
106 'instructions' => __( 'Define an endpoint for the previous accordion to stop. This accordion will not be visible.', 'acf' ),
107 'name' => 'endpoint',
108 'type' => 'true_false',
109 'ui' => 1,
110 )
111 );
112 }
113
114
115 /**
116 * This filter is appied to the $field after it is loaded from the database
117 *
118 * @type filter
119 * @since 3.6
120 * @date 23/01/13
121 *
122 * @param $field - the field array holding all the field options
123 *
124 * @return $field - the field array holding all the field options
125 */
126 function load_field( $field ) {
127
128 // remove name to avoid caching issue
129 $field['name'] = '';
130
131 // remove required to avoid JS issues
132 $field['required'] = 0;
133
134 // set value other than 'null' to avoid ACF loading / caching issue
135 $field['value'] = false;
136
137 // return
138 return $field;
139 }
140 }
141
142
143 // initialize
144 acf_register_field_type( 'acf_field__accordion' );
145 endif; // class_exists check
146
147 ?>
148