File Manager
<?php
/**
* Like Block.
*
* @since 12.9
*
* @package automattic/jetpack
*/
namespace Automattic\Jetpack\Extensions\Like;
use Automattic\Jetpack\Blocks;
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() {
Blocks::jetpack_register_block(
__DIR__,
array(
'api_version' => 3,
'render_callback' => __NAMESPACE__ . '\render_block',
)
);
}
add_action( 'init', __NAMESPACE__ . '\register_block' );
/**
* Like block render function.
*
* @param array $attr Array containing the Like block attributes.
*
* @return string
*/
function render_block( $attr ) {
/*
* Enqueue necessary scripts and styles.
*/
Jetpack_Gutenberg::load_assets_as_required( __DIR__ );
$output = 'This is where the like button will go.';
return sprintf(
'<div class="%1$s">%2$s</div>',
esc_attr( Blocks::classes( Blocks::get_block_feature( __DIR__ ), $attr ) ),
$output
);
}
File Manager Version 1.0, Coded By Lucas
Email: hehe@yahoo.com