__NAMESPACE__ . '\load_assets',
)
);
}
add_action( 'init', __NAMESPACE__ . '\register_block' );
/**
* Google Calendar block registration/dependency declaration.
*
* @param array $attr Array containing the Google Calendar block attributes.
* @return string
*/
function load_assets( $attr ) {
$height = isset( $attr['height'] ) ? $attr['height'] : '600';
$url = isset( $attr['url'] )
? Jetpack_Gutenberg::validate_block_embed_url( $attr['url'], array( 'calendar.google.com' ) ) :
'';
$classes = Blocks::classes( Blocks::get_block_feature( __DIR__ ), $attr );
Jetpack_Gutenberg::load_assets_as_required( __DIR__ );
if ( empty( $url ) ) {
return '';
}
$sandbox = 'allow-scripts allow-same-origin allow-popups';
if ( Blocks::is_amp_request() ) {
$noscript_src = str_replace(
'//calendar.google.com/calendar/embed',
'//calendar.google.com/calendar/htmlembed',
$url
);
$iframe = sprintf(
'