| 1 |
<?php |
| 2 |
/** |
| 3 |
* @package FireBox |
| 4 |
* @version 2.0.10 Free |
| 5 |
* |
| 6 |
* @author FirePlugins <info@fireplugins.com> |
| 7 |
* @link https://www.fireplugins.com |
| 8 |
* @copyright Copyright © 2023 FirePlugins All Rights Reserved |
| 9 |
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later |
| 10 |
*/ |
| 11 |
|
| 12 |
namespace FireBox\Core\Blocks\Form; |
| 13 |
|
| 14 |
if (!defined('ABSPATH')) |
| 15 |
{ |
| 16 |
exit; // Exit if accessed directly. |
| 17 |
} |
| 18 |
|
| 19 |
class Form extends \FireBox\Core\Blocks\Block |
| 20 |
{ |
| 21 |
/** |
| 22 |
* Block identifier. |
| 23 |
* |
| 24 |
* @var string |
| 25 |
*/ |
| 26 |
protected $name = 'form'; |
| 27 |
|
| 28 |
/** |
| 29 |
* Gutenberg Editor block style. |
| 30 |
* |
| 31 |
* @var string |
| 32 |
*/ |
| 33 |
protected $editor_style = 'fb-block-form'; |
| 34 |
|
| 35 |
/** |
| 36 |
* Gutenberg Editor block script. |
| 37 |
* |
| 38 |
* @var string |
| 39 |
*/ |
| 40 |
protected $editor_script = 'fb-block-form'; |
| 41 |
|
| 42 |
/** |
| 43 |
* Registers block assets. |
| 44 |
* |
| 45 |
* @return void |
| 46 |
*/ |
| 47 |
public function public_assets() |
| 48 |
{ |
| 49 |
wp_register_style( |
| 50 |
'fb-block-form', |
| 51 |
FBOX_MEDIA_PUBLIC_URL . 'css/blocks/form.css', |
| 52 |
[], |
| 53 |
FBOX_VERSION |
| 54 |
); |
| 55 |
|
| 56 |
wp_register_script( |
| 57 |
'fb-block-form', |
| 58 |
FBOX_MEDIA_PUBLIC_URL . 'js/blocks/form.js', |
| 59 |
[], |
| 60 |
FBOX_VERSION, |
| 61 |
true |
| 62 |
); |
| 63 |
} |
| 64 |
|
| 65 |
public function render_callback($atts, $content) |
| 66 |
{ |
| 67 |
wp_enqueue_style('fb-block-form'); |
| 68 |
wp_enqueue_script('fb-block-form'); |
| 69 |
|
| 70 |
return $content; |
| 71 |
} |
| 72 |
|
| 73 |
/** |
| 74 |
* Registers Gutenberg Editor block assets. |
| 75 |
* |
| 76 |
* @return void |
| 77 |
*/ |
| 78 |
public function assets() |
| 79 |
{ |
| 80 |
wp_register_script( |
| 81 |
'fb-block-form', |
| 82 |
FBOX_MEDIA_ADMIN_URL . 'js/blocks/blocks/form/form.js', |
| 83 |
['wp-i18n', 'wp-blocks', 'wp-editor', 'wp-components', 'wp-api-fetch'], |
| 84 |
FBOX_VERSION, |
| 85 |
true |
| 86 |
); |
| 87 |
} |
| 88 |
} |