array( __CLASS__, 'render' ), ) ); // Ensure editor localization is available whenever the block script loads. $handle = 'calcopolis-embed-editor-script'; if ( wp_script_is( $handle, 'registered' ) ) { wp_set_script_translations( $handle, 'calcopolis' ); wp_localize_script( $handle, 'calcopolisAdmin', array( 'ajaxUrl' => admin_url( 'admin-ajax.php' ), 'nonce' => wp_create_nonce( 'calcopolis_admin' ), 'connected' => Calcopolis_Connection::is_connected(), 'appBase' => Calcopolis_Hosts::app_base(), 'cdnBase' => Calcopolis_Hosts::cdn_base(), 'i18n' => array( 'reconnect' => __( 'Reconnect Calcopolis', 'calcopolis' ), 'copyShortcode' => __( 'Copy shortcode', 'calcopolis' ), 'copied' => __( 'Copied!', 'calcopolis' ), 'publishedList' => __( 'List of published forms', 'calcopolis' ), ), ) ); } } /** * @param array $attributes Block attributes. * @return string */ public static function render( $attributes ) { $args = array( 'id' => isset( $attributes['id'] ) ? $attributes['id'] : '', 'anchor' => isset( $attributes['anchor'] ) ? $attributes['anchor'] : '', 'position' => isset( $attributes['position'] ) ? $attributes['position'] : '', 'animation' => isset( $attributes['animation'] ) ? $attributes['animation'] : true, 'lazy' => isset( $attributes['lazy'] ) ? $attributes['lazy'] : false, 'defaults' => isset( $attributes['defaults'] ) && is_array( $attributes['defaults'] ) ? $attributes['defaults'] : array(), 'advanced_json' => isset( $attributes['advancedJson'] ) ? $attributes['advancedJson'] : '', ); return Calcopolis_Embed_Renderer::render( $args ); } }