22 'title' => __(
'GravityView View Details',
'gk-gravityview' ),
23 'render_callback' => [ $this,
'render' ],
25 'previewImage' => untrailingslashit( plugin_dir_url( __FILE__ ) ) .
'/preview.svg' 39 static function render( $block_attributes = [] ) {
40 $block_to_shortcode_attributes_map = [
45 $shortcode_attributes = [];
47 foreach ( $block_attributes as $attribute =>
$value ) {
50 if ( isset( $block_to_shortcode_attributes_map[ $attribute ] ) && ! empty(
$value ) ) {
51 $shortcode_attributes[] = sprintf(
53 $block_to_shortcode_attributes_map[ $attribute ],
54 str_replace(
'"',
'\"',
$value )
59 $shortcode = sprintf(
'[gravityview %s]', implode(
' ', $shortcode_attributes ) );
61 if (
Arr::get( $block_attributes,
'previewAsShortcode' ) ) {
67 return $rendered_shortcode[
'content'];
static render( $block_attributes=[])
Renders [gravityview] shortcode.
static get( $array, $key, $default=null)
{}
modify_block_meta( $block_meta)
Modifies block meta.
static render_shortcode( $shortcode)
Renders shortcode and returns rendered content along with newly enqueued scripts and styles...