'heading', 'link_label' => 'linkLabel', 'banks_label' => 'banksLabel', 'copy_label' => 'copyLabel', 'qr_caption' => 'qrCaption', 'recipient_label' => 'recipientLabel', 'account_label' => 'accountLabel', 'bic_label' => 'bicLabel', 'purpose_label' => 'purposeLabel', 'amount_label' => 'amountLabel', 'other_label' => 'otherLabel', 'reference_label' => 'referenceLabel', 'amount' => 'amount', 'amounts' => 'amounts', 'purpose' => 'purpose', 'reference' => 'reference', 'accounts' => 'accounts', 'links' => 'links', 'show_link' => 'showLink', 'show_qr' => 'showQr', 'anchor' => 'anchor', ); add_action( 'init', static function () { add_shortcode( 'ibanbox', __NAMESPACE__ . '\render_shortcode' ); } ); /** * Renders the block with the attributes the shortcode was given; the rest keep the block's defaults. * * @param array|string $atts Shortcode attributes, or an empty string when there are none. */ function render_shortcode( $atts ): string { $atts = is_array( $atts ) ? $atts : array(); $attrs = array(); foreach ( SHORTCODE_ATTRIBUTES as $name => $attribute ) { if ( ! isset( $atts[ $name ] ) ) { continue; } if ( in_array( $attribute, array( 'showLink', 'showQr' ), true ) ) { $attrs[ $attribute ] = filter_var( $atts[ $name ], FILTER_VALIDATE_BOOLEAN ); } elseif ( in_array( $attribute, array( 'accounts', 'links' ), true ) ) { $attrs[ $attribute ] = parse_ids( $atts[ $name ] ); } elseif ( 'anchor' === $attribute ) { $attrs[ $attribute ] = sanitize_html_class( $atts[ $name ] ); } else { $attrs[ $attribute ] = sanitize_text_field( $atts[ $name ] ); } } return render_block( array( 'blockName' => 'ibanbox/details', 'attrs' => $attrs, 'innerBlocks' => array(), 'innerHTML' => '', 'innerContent' => array(), ) ); }