<?php
/**
 * Public registration: shortcode, block, front-end style.
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

function publiton_register_public() {
	wp_register_style( 'publiton-publications', PUBLITON_PLUGIN_URL . 'assets/css/publications.css', array(), PUBLITON_VERSION );

	wp_register_script(
		'publiton-block-editor',
		PUBLITON_PLUGIN_URL . 'blocks/publication-list/editor.js',
		array( 'wp-blocks', 'wp-element', 'wp-server-side-render' ),
		PUBLITON_VERSION,
		true
	);

	register_block_type(
		PUBLITON_PLUGIN_DIR . 'blocks/publication-list',
		array( 'render_callback' => 'publiton_render_publications' )
	);

	add_shortcode( 'publiton_publications', 'publiton_render_publications' );
}
add_action( 'init', 'publiton_register_public' );
