PluginProbe
SureDonation – Donation Forms, Fundraising Campaigns & Donor Management / trunk
SureDonation – Donation Forms, Fundraising Campaigns & Donor Management vtrunk
1.6.0 1.5.1 1.5.0 1.4.0 1.3.0 trunk 0.0.1 1.0.0 1.1.0 1.1.1 1.1.2 1.2.0
suredonation / inc / blocks / input / block.php

block.php in SureDonation – Donation Forms, Fundraising Campaigns & Donor Management trunk, at inc/blocks/input/block.php

51 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * PHP render for Input Block.
4 *
5 * @package SureDonation
6 * @since 0.0.1
7 */
8
9 namespace SureDonation\Inc\Blocks\Input;
10
11 use SureDonation\Inc\Blocks\Base;
12 use SureDonation\Inc\Fields\Input_Markup;
13
14 if ( ! defined( 'ABSPATH' ) ) {
15 exit; // Exit if accessed directly.
16 }
17
18 /**
19 * Input Block.
20 *
21 * @since 0.0.1
22 */
23 class Block extends Base {
24 /**
25 * Render the block
26 *
27 * @param array<string, mixed> $attributes Block attributes.
28 * @param string $content Block content.
29 * @return string
30 * @since 0.0.1
31 */
32 public function render( $attributes, $content = '' ) {
33 unset( $content ); // Unused parameter.
34
35 if ( empty( $attributes ) ) {
36 return '';
37 }
38
39 // Load the Inputmask library only when this field uses an input pattern.
40 if ( ! empty( $attributes['inputMask'] ) && 'none' !== $attributes['inputMask'] ) {
41 wp_enqueue_script( 'suredonation-inputmask' );
42 }
43
44 $markup_class = new Input_Markup( $attributes );
45 ob_start();
46 echo wp_kses( $markup_class->markup(), self::get_allowed_form_html() );
47 $output = ob_get_clean();
48 return false !== $output ? $output : '';
49 }
50 }
51