PluginProbe
SureForms – Contact Form Builder, AI Forms, Payment Form, Survey & Quiz / 0.0.10
SureForms – Contact Form Builder, AI Forms, Payment Form, Survey & Quiz v0.0.10
2.12.8 2.12.7 2.12.6 2.12.5 2.12.4 2.12.3 2.12.2 2.12.1 2.12.0 2.11.1 2.11.0 2.10.1 2.10.0 2.9.1 2.9.0 2.8.2 2.8.1 2.7.0 2.7.1 2.8.0 trunk 0.0.10 0.0.11 0.0.12 0.0.13 All 98 releases
sureforms / inc / fields / input-markup.php

input-markup.php in SureForms – Contact Form Builder, AI Forms, Payment Form, Survey & Quiz 0.0.10, at inc/fields/input-markup.php

74 lines 2.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Sureforms Input Markup Class file.
4 *
5 * @package sureforms.
6 * @since 0.0.1
7 */
8
9 namespace SRFM\Inc\Fields;
10
11 if ( ! defined( 'ABSPATH' ) ) {
12 exit; // Exit if accessed directly.
13 }
14
15 /**
16 * Sureforms Input Markup Class.
17 *
18 * @since 0.0.1
19 */
20 class Input_Markup extends Base {
21
22 /**
23 * Maximum length of text allowed for an input field.
24 *
25 * @var string
26 * @since 0.0.2
27 */
28 protected $max_text_length;
29
30 /**
31 * Initialize the properties based on block attributes.
32 *
33 * @param array<mixed> $attributes Block attributes.
34 * @since 0.0.2
35 */
36 public function __construct( $attributes ) {
37 $this->slug = 'input';
38 $this->max_text_length = isset( $attributes['textLength'] ) ? $attributes['textLength'] : '';
39 $this->set_properties( $attributes );
40 $this->set_input_label( __( 'Text Field', 'sureforms' ) );
41 $this->set_error_msg( $attributes, 'srfm_input_block_required_text' );
42 $this->set_duplicate_msg( $attributes, 'srfm_input_block_unique_text' );
43 $this->set_unique_slug();
44 $this->set_field_name( $this->unique_slug );
45 $this->set_markup_properties( $this->input_label );
46 $this->set_aria_described_by();
47 $this->set_label_as_placeholder( $this->input_label );
48 }
49
50 /**
51 * Render input markup
52 *
53 * @since 0.0.2
54 * @return string|boolean
55 */
56 public function markup() {
57 ob_start(); ?>
58 <div data-block-id="<?php echo esc_attr( $this->block_id ); ?>" class="srfm-block-single srfm-block srfm-<?php echo esc_attr( $this->slug ); ?>-block srf-<?php echo esc_attr( $this->slug ); ?>-<?php echo esc_attr( $this->block_id ); ?>-block<?php echo esc_attr( $this->block_width ); ?><?php echo esc_attr( $this->class_name ); ?> <?php echo esc_attr( $this->conditional_class ); ?>">
59 <?php echo wp_kses_post( $this->label_markup ); ?>
60 <?php echo wp_kses_post( $this->help_markup ); ?>
61 <div class="srfm-block-wrap">
62 <input class="srfm-input-common srfm-input-<?php echo esc_attr( $this->slug ); ?>" type="text" name="<?php echo esc_attr( $this->field_name ); ?>" id="<?php echo esc_attr( $this->unique_slug ); ?>"
63 <?php echo ! empty( $this->aria_described_by ) ? "aria-describedby='" . esc_attr( trim( $this->aria_described_by ) ) . "'" : ''; ?>
64 aria-required="<?php echo esc_attr( strval( $this->aria_require_attr ) ); ?>" data-unique="<?php echo esc_attr( $this->aria_unique ); ?>" maxlength="<?php echo esc_attr( $this->max_text_length ); ?>" value="<?php echo esc_attr( $this->default ); ?>" <?php echo wp_kses_post( $this->placeholder_attr ); ?> />
65 </div>
66 <div class="srfm-error-wrap">
67 <?php echo wp_kses_post( $this->duplicate_msg_markup ); ?>
68 </div>
69 </div>
70 <?php
71 return ob_get_clean();
72 }
73 }
74