kollapsminoriteten/wp-content/plugins/jetpack/extensions/blocks/amazon/amazon.php

40 lines
867 B
PHP
Raw Normal View History

2020-03-03 18:49:45 +01:00
<?php
/**
* Amazon Block.
*
* @since 8.x
*
2021-04-27 08:32:47 +02:00
* @package automattic/jetpack
2020-03-03 18:49:45 +01:00
*/
2020-05-06 17:20:49 +02:00
namespace Automattic\Jetpack\Extensions\Amazon;
2020-11-18 09:10:44 +01:00
use Automattic\Jetpack\Blocks;
2020-05-06 17:20:49 +02:00
use Jetpack_Gutenberg;
/**
* Registers the block for use in Gutenberg
* This is done via an action so that we can disable
* registration if we need to.
*/
function register_block() {
2020-11-18 09:10:44 +01:00
Blocks::jetpack_register_block(
2023-09-26 10:24:36 +02:00
__DIR__,
2020-05-06 17:20:49 +02:00
array( 'render_callback' => __NAMESPACE__ . '\load_assets' )
);
}
add_action( 'init', __NAMESPACE__ . '\register_block' );
2020-03-03 18:49:45 +01:00
/**
* Amazon block registration/dependency declaration.
*
* @param array $attr Array containing the Amazon block attributes.
* @param string $content String containing the Amazon block content.
*
* @return string
*/
2020-05-06 17:20:49 +02:00
function load_assets( $attr, $content ) {
2023-09-26 10:24:36 +02:00
Jetpack_Gutenberg::load_assets_as_required( __DIR__ );
2020-03-03 18:49:45 +01:00
return $content;
}