PluginProbe
SureDonation – Donation Forms, Fundraising Campaigns & Donor Management / 1.1.1
SureDonation – Donation Forms, Fundraising Campaigns & Donor Management v1.1.1
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 / fields / address-markup.php

address-markup.php in SureDonation – Donation Forms, Fundraising Campaigns & Donor Management 1.1.1, at inc/fields/address-markup.php

69 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * SureDonation Address Markup Class.
4 *
5 * @package SureDonation
6 * @since 1.1.1
7 */
8
9 namespace SureDonation\Inc\Fields;
10
11 if ( ! defined( 'ABSPATH' ) ) {
12 exit; // Exit if accessed directly.
13 }
14
15 /**
16 * Address Markup Class.
17 *
18 * The address field is a container: its sub-fields (street, city, state, postal
19 * code, country) are real suredonation/input and suredonation/dropdown inner
20 * blocks that render and validate themselves. This class only renders the
21 * fieldset/legend wrapper around that inner block content.
22 *
23 * @since 1.1.1
24 */
25 class Address_Markup extends Base {
26 /**
27 * Initialize the properties based on block attributes.
28 *
29 * @param array<string, mixed> $attributes Block attributes.
30 * @since 1.1.1
31 */
32 public function __construct( $attributes ) {
33 $this->slug = 'address';
34
35 $this->set_properties( $attributes );
36 $this->set_unique_slug();
37 $this->set_markup_properties();
38 }
39
40 /**
41 * Render address markup.
42 *
43 * @param string $content Inner block content (the rendered sub-fields).
44 * @since 1.1.1
45 * @return string
46 */
47 public function markup( $content = '' ) {
48 $classes = $this->get_field_classes();
49
50 ob_start();
51 ?>
52 <div data-block-id="<?php echo esc_attr( $this->block_id ); ?>" class="<?php echo esc_attr( $classes ); ?>">
53 <fieldset>
54 <?php if ( '' !== $this->label ) { ?>
55 <legend class="sd-block-legend sd-label">
56 <?php echo esc_html( $this->label ); ?>
57 </legend>
58 <?php } ?>
59 <?php echo wp_kses_post( $this->help_markup ); ?>
60 <div class="sd-block-wrap sd-address-fields">
61 <?php echo $content; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Inner block content already rendered and escaped by each child block. ?>
62 </div>
63 </fieldset>
64 </div>
65 <?php
66 return (string) ob_get_clean();
67 }
68 }
69