kollapsminoriteten/wp-content/plugins/jetpack/extensions/blocks/send-a-message/whatsapp-button/whatsapp-button.php

46 lines
1007 B
PHP
Raw Normal View History

2020-09-15 14:30:05 +02:00
<?php
/**
* WhatsApp Button Block.
*
2021-04-27 08:32:47 +02:00
* @package automattic/jetpack
2020-09-15 14:30:05 +02:00
*/
namespace Automattic\Jetpack\Extensions\WhatsApp_Button;
2020-11-18 09:10:44 +01:00
use Automattic\Jetpack\Blocks;
2020-09-15 14:30:05 +02:00
use Jetpack_Gutenberg;
const PARENT_NAME = 'send-a-message';
const FEATURE_NAME = 'whatsapp-button';
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() {
2020-11-18 09:10:44 +01:00
Blocks::jetpack_register_block(
2020-09-15 14:30:05 +02:00
BLOCK_NAME,
2021-04-27 08:32:47 +02:00
array(
'render_callback' => __NAMESPACE__ . '\render_block',
'plan_check' => true,
)
2020-09-15 14:30:05 +02:00
);
}
add_action( 'init', __NAMESPACE__ . '\register_block' );
/**
* Render callback.
*
* @param array $attributes Array containing the block attributes.
* @param string $content String containing the block content.
*
* @return string
*/
function render_block( $attributes, $content ) {
2021-04-27 08:32:47 +02:00
Jetpack_Gutenberg::load_styles_as_required( PARENT_NAME );
2020-09-15 14:30:05 +02:00
return $content;
}