software-license-manager/includes/slm-blocks.php
Michel f1918ebf47 Add custom block category "SLM Plus" and improve shortcode blocks
feat: Add custom block category "SLM Plus" and improve shortcode blocks

- Registered a new block category "SLM Plus" for better organization.
- Updated "Forgot License" and "List Licenses" blocks to assign them to the custom category.
- Improved block editor previews for both blocks:
  - "Forgot License" block displays a preview with a form placeholder.
  - "List Licenses" block displays a preview with a sample list of licenses.
- Fixed issues with blocks appearing under "Uncategorized" by ensuring proper category registration.
- Ensured unique naming in block scripts to avoid conflicts.
- Added clear styles for block previews and frontend rendering in `slm-blocks.css`.
- Verified shortcode functionality for rendering licenses dynamically.
2024-12-06 16:16:43 -05:00

25 lines
532 B
PHP

<?php
// If this file is called directly, abort.
if (!defined('WPINC')) {
die();
}
// Register block editor assets.
add_action('enqueue_block_editor_assets', function () {
wp_enqueue_script(
'slm-blocks-js',
SLM_ASSETS_URL . 'js/slm-blocks.js',
['wp-blocks', 'wp-editor', 'wp-element', 'wp-i18n'], // Dependencies.
SLM_VERSION,
true
);
wp_enqueue_style(
'slm-blocks-style',
SLM_ASSETS_URL . 'css/slm-blocks.css',
[],
SLM_VERSION
);
});