3, 'title' => __( 'Quote list', 'boring-quote' ), 'category' => 'woocommerce', 'editor_script' => 'bbquote-blocks', 'supports' => array( 'html' => false, 'multiple' => false, ), 'render_callback' => array( $this, 'render_list' ), ) ); register_block_type( 'boring-quote/count', array( 'api_version' => 3, 'title' => __( 'Quote list counter', 'boring-quote' ), 'category' => 'woocommerce', 'editor_script' => 'bbquote-blocks', 'attributes' => array( 'label' => array( 'type' => 'string', 'default' => '', ), ), 'supports' => array( 'html' => false ), 'render_callback' => array( $this, 'render_count' ), ) ); } /** * Render the quote list block. * * @return string */ public function render_list() { return do_shortcode( '[bbquote_quote_list]' ); } /** * Render the counter block. * * @param array $attributes Block attributes. * @return string */ public function render_count( $attributes ) { $label = isset( $attributes['label'] ) ? trim( (string) $attributes['label'] ) : ''; return '
' . Shortcodes::render_count( $label ) . '
'; } }