New $ Sign Issue: Now Strips Out Content

Support MB Blocks New $ Sign Issue: Now Strips Out Content

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #45924
    Johannes GrossJohannes Gross
    Participant

    I know you just fixed a bug that caused the $ to be escaped. However, I now ran into an issue where $100/person in a paragraph block within the <InnerBlocks /> go changed to 0/person. After I escaped it in the paragraph block (\$100/person), it displayed it correctly.

    Here is my block setup:

    $meta_boxes[] = array(
    		'id'              => 'twt-date',
    		'title'           => 'TWT Date',
    		'type'            => 'block',
    		'icon'            => 'editor-table',
    		'category'        => 'layout',
    		//'context'         => 'side',
    		'render_template' => get_stylesheet_directory() . '/blocks/twt-date.php',
    		'enqueue_assets'  => function () {
    			wp_enqueue_style( 'twt-hero', get_stylesheet_directory_uri() . '/blocks/twt-date.css', array(), filemtime( get_stylesheet_directory() . "/blocks/twt-date.css" ) );
    		},
    		'supports'        => array(
    			'anchor'          => true,
    			'customClassName' => true
    		),
    		'fields'          => array(
    			array(
    				'name'    => 'Date',
    				'id'      => 'date',
    				'type'    => 'date',
    				'timestamp' => true
    			),
                array(
    	            'name'    => 'Custom Month',
    	            'id'      => 'custom_month',
    	            'type'    => 'text',
                ),
    			array(
    				'name'    => 'Custom Day',
    				'id'      => 'custom_day',
    				'type'    => 'text',
    			),
    			array(
    				'name'    => 'Custom Year',
    				'id'      => 'custom_year',
    				'type'    => 'text',
    			)
    		)
    	);

    And here is my template:

    '<?php
    $attr = $attributes;
    // Assign anchor if available
    $id = $attr['anchor'] ?? '';

    // Custom CSS class name.
    $class = trim('twt-date-c ' . ( $attr['className'] ?? '' ));
    ?>
    <div<?= empty($id) ? '' : ' id="'.esc_attr($id).'"'; ?><?= empty( $class ) ? '' : ' class="'.esc_attr($class). '"'; ?>>
    <?php
    if(!empty($attr['data']['custom_month']) || !empty($attr['data']['custom_year']) || !empty($attr['data']['custom_day'])) {
    ?>
    <div class="twt-date">
    <div class="m<?= empty($attr['data']['custom_day']) ? ' all-month' : ''; ?>"><?= $attr['data']['custom_month'] ?? ''; ?></div>
    <div class="d"><?= $attr['data']['custom_day'] ?? ''; ?></div>
    <div class="y"><?= $attr['data']['custom_year'] ?? ''; ?></div>
    </div>
    <?php
    } elseif(!empty($attr['data']['date'])) {
    $date = new DateTime();
    $date->setTimestamp($attr['data']['date']);
    ?><div class="twt-date">
    <div class="m"><?= $date->format('M'); ?></div>
    <div class="d"><?= $date->format('j'); ?></div>
    <div class="y"><?= $date->format('Y'); ?></div>
    </div>
    <?php
    }
    ?>
    <div class="twt-date-content">
    <InnerBlocks />
    </div>
    </div>
    `

    #45949
    PeterPeter
    Moderator

    Hello Johannes,

    Thank you for your feedback.

    I've escalated this issue to the development team to fix it in the next update of the block plugin.

    #45968
    MauroMauro
    Participant

    I confirm this issue is in the latest update with all my custom MB Blocks

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.