22 'title' => __(
'GravityView Entry',
'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 = [
42 'viewId' =>
'view_id',
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(
'[gventry %s]', implode(
' ', $shortcode_attributes ) );
61 if (
Arr::get( $block_attributes,
'previewAsShortcode' ) ) {
67 return $rendered_shortcode[
'content'];
static get( $array, $key, $default=null)
{}
static render( $block_attributes=[])
Renders [gventry] shortcode.
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...