PluginProbe
Hello Plus / trunk
Hello Plus vtrunk
trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.2.1 1.3.0 1.4.0 1.4.1 1.5.0 1.5.1 1.5.2 1.5.3 1.6.0 1.6.1 1.6.2 1.7.0 1.7.1 1.7.2 1.7.3 All 30 releases
hello-plus / modules / forms / fields / acceptance.php

acceptance.php in Hello Plus trunk, at modules/forms/fields/acceptance.php

49 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace HelloPlus\Modules\Forms\Fields;
3
4 if ( ! defined( 'ABSPATH' ) ) {
5 exit; // Exit if accessed directly
6 }
7
8 class Acceptance extends Field_Base {
9
10 public function get_type() {
11 return 'ehp-acceptance';
12 }
13
14 public function get_name() {
15 return esc_html__( 'Acceptance', 'hello-plus' );
16 }
17
18 public function render( $item, $item_index, $form ) {
19 $label = '';
20 $form->add_render_attribute( 'input' . $item_index, 'class', 'elementor-acceptance-field' );
21 $form->add_render_attribute( 'input' . $item_index, 'type', 'checkbox', true );
22
23 if ( ! empty( $item['acceptance_text'] ) ) {
24 $label = '<label for="' . $form->get_attribute_id( $item ) . '">' . $item['acceptance_text'] . '</label>';
25 }
26
27 if ( ! empty( $item['checked_by_default'] ) ) {
28 $form->add_render_attribute( 'input' . $item_index, 'checked', 'checked' );
29 }
30
31 ?>
32 <div class="elementor-field-subgroup">
33 <span class="elementor-field-option">
34 <input <?php $form->print_render_attribute_string( 'input' . $item_index ); ?>>
35 <?php
36 echo wp_kses( $label, [
37 'label' => [
38 'for' => true,
39 'class' => true,
40 'id' => true,
41 'style' => true,
42 ],
43 ] ); ?>
44 </span>
45 </div>
46 <?php
47 }
48 }
49