PluginProbe
SureDonation – Donation Forms, Fundraising Campaigns & Donor Management / 1.6.1
SureDonation – Donation Forms, Fundraising Campaigns & Donor Management v1.6.1
1.6.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
← All changes | inc/blocks/base.php +32 -0 0.0.1 → 1.6.1 View file →
@@ -87,5 +87,37 @@
87 87 */
88 88 protected static function get_allowed_form_html() {
89 89 return Helper::get_allowed_form_html();
90 90 }
91 +
92 + /**
93 + * Build the wrapper class string shared by display blocks (Heading, HTML).
94 + *
95 + * Display blocks have no field name, so they intentionally omit the
96 + * per-instance `sd-{slug}-{block_id}-block` class that field blocks carry.
97 + * This derives the common width/className/slug classes and prepends the
98 + * block-specific base class.
99 + *
100 + * @param array<string, mixed> $attributes Block attributes.
101 + * @param string $base_class Block-specific base class (e.g. 'sd-heading-block').
102 + * @return string Joined wrapper class string.
103 + * @since 1.1.1
104 + */
105 + protected static function get_display_block_classes( $attributes, $base_class ) {
106 + $field_width = isset( $attributes['fieldWidth'] ) ? Helper::get_string_value( $attributes['fieldWidth'] ) : '';
107 + $block_width = $field_width ? ' sd-block-width-' . str_replace( '.', '-', $field_width ) : '';
108 + $class_name = isset( $attributes['className'] ) && is_string( $attributes['className'] ) ? ' ' . $attributes['className'] : '';
109 + $block_slug = isset( $attributes['slug'] ) && is_string( $attributes['slug'] ) ? $attributes['slug'] : '';
110 + $slug_class = $block_slug ? ' sd-slug-' . $block_slug : '';
111 +
112 + return Helper::join_strings(
113 + [
114 + 'sd-block-single',
115 + 'sd-block',
116 + $base_class,
117 + $block_width,
118 + $class_name,
119 + $slug_class,
120 + ]
121 + );
122 + }
91 123 }