Untitled

 avatar
unknown
plain_text
5 months ago
2.3 kB
3
Indexable
in this code component_attrs values of type & title are coming "abc" and "casc" but it should come  args['gtm']['component_title'] &  $args['gtm']['component_type']

<?php print_gtm_attributes($component_attrs, true); ?>> 
when we are doing echo below code then it is working fine
echo json_encode($component_attrs);

the values of args['gtm']['component_title'] &  args['gtm']['component_type']  are comming {“component_title”:”One-on-One with Gilles Dellaert: More Than Just a Moment in Time for Private Credit”,”component_type”:”Article Content – Inline Disclaimer”} but it is not coming for print_gtm_attributes please correct the code

Modify below php code accordingly

<?php
/**
 * InlineDisclaimer block markup
 *
 * @package Blackstone
 *
 * @var array    $attributes         Block attributes.
 * @var array    $args		         Component attributes.
 */
use function BxTheme\Utility\print_gtm_attributes;

$attributes = wp_parse_args(
	$args ?? [],
	[
		'disclaimer'            => '',
		'isCollapseEnabled'     => false,
	]
);

// $component_title = trim($args['gtm']['component_title'] ?? '');
// $component_type = trim($args['gtm']['component_type'] ?? '');
$component_title1 = $args['gtm']['component_title'] ?? 'abc';
echo $component_title1;
echo "<br/>";
$component_type2 = $args['gtm']['component_type'] ?? 'casc';
echo $component_type2;
echo "<br/>";

$component_attrs = array (
	'component_title' => $component_title1,
	'component_type'  => $component_type2,
);

echo json_encode($component_attrs);
if ( empty( $attributes['disclaimer'] ) ) {
	return;
}

$isCollapseEnabled = isset($attributes['isCollapseEnabled']) ? $attributes['isCollapseEnabled'] : false;
?>

	<div class="bx-inline-disclaimer__inner" data-collapse="<?php echo wp_kses_post($isCollapseEnabled);?>"  <?php print_gtm_attributes($component_attrs,true); echo "check check"; echo json_encode($component_type); echo $component_title?>> 
	<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