PluginProbe
Block Animations, Motion & Scroll Effects – Ghost Kit / 3.4.1
Block Animations, Motion & Scroll Effects – Ghost Kit v3.4.1
3.7.2 3.7.1 3.7.0 3.6.1 trunk 1.6.3 2.25.0 3.3.0 3.3.1 3.3.2 3.3.3 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.6 3.5.0 3.5.1 3.6.0
ghostkit / gutenberg / blocks / form / field-label / index.php

index.php in Block Animations, Motion & Scroll Effects – Ghost Kit 3.4.1, at gutenberg/blocks/form/field-label/index.php

63 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Form field label.
4 *
5 * @package ghostkit
6 */
7
8 if ( ! defined( 'ABSPATH' ) ) {
9 exit;
10 }
11
12 /**
13 * Class GhostKit_Form_Field_Label
14 */
15 class GhostKit_Form_Field_Label {
16 /**
17 * Prepare label for field.
18 *
19 * @param array $attributes block attributes.
20 */
21 public static function get( $attributes ) {
22 $attributes = array_merge(
23 array(
24 'slug' => '',
25 'label' => '',
26 'required' => false,
27 'hideLabel' => false,
28 'removeLabel' => false,
29 'slug' => null,
30 ),
31 $attributes
32 );
33
34 $label = $attributes['label'];
35 $hide_label = $attributes['hideLabel'];
36 $class = 'ghostkit-form-field-label';
37
38 if ( $label && $attributes['required'] ) {
39 $label .= '<span class="required">*</span>';
40 }
41
42 $label_attrs = array(
43 'for' => $attributes['slug'],
44 );
45
46 if ( $hide_label ) {
47 $class .= ' ghostkit-form-field-label-hidden';
48 }
49
50 if ( $label ) {
51 ?>
52 <?php if ( ! $attributes['removeLabel'] ) : ?>
53 <label class="<?php echo esc_attr( $class ); ?>" <?php GhostKit_Form_Field_Attributes::get( $label_attrs ); ?>>
54 <?php echo wp_kses_post( $label ); ?>
55 </label>
56 <?php endif; ?>
57 <input type="hidden" name="<?php echo esc_attr( $attributes['slug'] ); ?>[label]" value="<?php echo esc_attr( $attributes['label'] ); ?>" />
58 <?php
59 }
60 }
61 }
62 new GhostKit_Form_Field_Label();
63