for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* Donations Block.
*
* @since 8.x
* @package Jetpack
*/
namespace Automattic\Jetpack\Extensions\Donations;
use Jetpack_Gutenberg;
const FEATURE_NAME = 'donations';
const BLOCK_NAME = 'jetpack/' . FEATURE_NAME;
* 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() {
jetpack_register_block(
BLOCK_NAME,
array(
'render_callback' => __NAMESPACE__ . '\load_assets',
'plan_check' => true,
)
);
}
add_action( 'init', __NAMESPACE__ . '\register_block' );
* Donations block registration/dependency declaration.
* @param array $attr Array containing the Donations block attributes.
* @param string $content String containing the Donations block content.
* @return string
function load_assets( $attr, $content ) {
Jetpack_Gutenberg::load_assets_as_required( FEATURE_NAME );
return $content;