PluginProbe
SureForms – Contact Form Builder, AI Forms, Payment Form, Survey & Quiz / 0.0.13
SureForms – Contact Form Builder, AI Forms, Payment Form, Survey & Quiz v0.0.13
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 0.0.2 All 97 releases
sureforms / inc / fields / phone-markup.php

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

73 lines 2.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Sureforms Phone 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_Phone_Markup Class.
17 *
18 * @since 0.0.1
19 */
20 class Phone_Markup extends Base {
21
22 /**
23 * Stores the boolean string indicating if the country should be automatically determined.
24 *
25 * @var string
26 * @since 0.0.2
27 */
28 protected $auto_country;
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->set_properties( $attributes );
38 $this->set_input_label( __( 'Phone', 'sureforms' ) );
39 $this->set_error_msg( $attributes, 'srfm_phone_block_required_text' );
40 $this->slug = 'phone';
41 $this->auto_country = isset( $attributes['autoCountry'] ) ? $attributes['autoCountry'] : '';
42 $this->set_unique_slug();
43 $this->set_field_name( $this->unique_slug );
44 $this->set_markup_properties( $this->input_label, true );
45 $this->set_aria_described_by();
46 $this->set_label_as_placeholder( $this->input_label );
47 }
48
49 /**
50 * Render the sureforms phone classic styling
51 *
52 * @since 0.0.2
53 * @return string|boolean
54 */
55 public function markup() {
56 ob_start(); ?>
57 <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 ); ?>">
58 <?php echo wp_kses_post( $this->label_markup ); ?>
59 <?php echo wp_kses_post( $this->help_markup ); ?>
60 <div class="srfm-block-wrap">
61 <input type="tel" class="srfm-input-common srfm-input-<?php echo esc_attr( $this->slug ); ?>" name="<?php echo esc_attr( $this->field_name ); ?>" id="<?php echo esc_attr( $this->unique_slug ); ?>"
62 <?php echo ! empty( $this->aria_described_by ) ? "aria-describedby='" . esc_attr( trim( $this->aria_described_by ) ) . "'" : ''; ?>
63 aria-required="<?php echo esc_attr( $this->aria_require_attr ); ?>" auto-country="<?php echo esc_attr( $this->auto_country ? 'true' : 'false' ); ?>" value="" <?php echo wp_kses_post( $this->placeholder_attr ); ?>>
64 </div>
65 <div class="srfm-error-wrap">
66 <?php echo wp_kses_post( $this->error_msg_markup ); ?>
67 </div>
68 </div>
69 <?php
70 return ob_get_clean();
71 }
72 }
73