Untitled
unknown
plain_text
a year ago
2.0 kB
7
Indexable
<?php
/**
* InlineDisclaimer block markup
*
* @package Blackstone
*
* @var array $attributes Block attributes.
* @var array $args Component attributes.
*/
$attributes = wp_parse_args(
$args ?? [],
[
'disclaimer' => '',
'parent_component_name' => '', // Add parent component name to args
'isCollapseEnabled' => false,
]
);
if ( empty( $attributes['disclaimer'] ) ) {
return;
}
$isCollapseEnabled = isset($attributes['isCollapseEnabled']) ? $attributes['isCollapseEnabled'] : false;
$gtm_attrs = array (
'gtm' => [
'tag_name' => 'CTA Click',
'page_name' => $page_name,
'page_url' => 'null',
'component_type' => $args['parent_component_name'],
'click_text' => wp_strip_all_tags($attributes['link']['text']) /* phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped */,
'click_url' => wp_strip_all_tags($attributes['link']['url']) /* phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped */,
'component_title'=> wp_strip_all_tags($attributes['title']) // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
],
);
// Convert the PHP array to a JSON string
$gtm_attrs_json = json_encode($gtm_attrs);
// Output the JavaScript console log
echo $gtm_attrs_json;
echo $args['disclaimer'];
echo $args['parent_component_name'];
$page_enagement_attrs = array (
'tag_name' => 'Page Engagement Click',
'component_type' => 'Event Component',
'component_title'=> '',
'click_url' => '',
);
?>
<div class="bx-inline-disclaimer__inner" data-collapse="<?php echo wp_kses_post($isCollapseEnabled);?>">
<div class="bx-inline-disclaimer__item">
<?php if(wp_kses_post($args['disclaimer']) !== ""){ ?>
<div class="bx-inline-disclaimer__content" role="article">
<p class="bx-inline-disclaimer__content-font" >
<?=wp_kses_post($args['disclaimer']); ?>
</p>
</div>
<?php } ?>
</div>
</div>
Editor is loading...
Leave a Comment