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

44 lines
963 B
PHP
Raw Permalink Normal View History

2020-09-15 14:30:05 +02:00
<?php
/**
* Send a Message Block.
*
2021-04-27 08:32:47 +02:00
* @package automattic/jetpack
2020-09-15 14:30:05 +02:00
*/
namespace Automattic\Jetpack\Extensions\Send_A_Message;
2020-12-10 14:04:11 +01:00
require_once __DIR__ . '/whatsapp-button/whatsapp-button.php';
2020-09-15 14:30:05 +02:00
2020-11-18 09:10:44 +01:00
use Automattic\Jetpack\Blocks;
2020-09-15 14:30:05 +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-12-07 09:44:11 +01:00
__DIR__,
2020-09-15 14:30:05 +02:00
array(
'render_callback' => __NAMESPACE__ . '\render_block',
2021-07-23 11:58:50 +02:00
'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 ) {
2023-12-07 09:44:11 +01:00
Jetpack_Gutenberg::load_styles_as_required( Blocks::get_block_feature( __DIR__ ) );
2020-09-15 14:30:05 +02:00
return $content;
}