array( $this, 'render' ), 'editor_script' => 'advk-block-editor', ) ); } /** * Server-side render: delegate to the shortcode so editor preview and * frontend output stay identical. * * @param array $attributes Block attributes. * @return string */ public function render( $attributes ) { $attributes = is_array( $attributes ) ? $attributes : array(); $atts = array(); foreach ( array( 'theme', 'layout', 'door_style', 'quiz_mode' ) as $key ) { if ( ! empty( $attributes[ $key ] ) ) { $atts[] = $key . '="' . esc_attr( $attributes[ $key ] ) . '"'; } } $shortcode = '[advk_calendar' . ( $atts ? ' ' . implode( ' ', $atts ) : '' ) . ']'; return do_shortcode( $shortcode ); } }