Use wp class intead of calling functions directly

[MAILPOET-1798]
This commit is contained in:
Pavel Dohnal
2020-02-06 13:31:53 +01:00
committed by Jack Kitterhing
parent 5ad6016a60
commit 8da7330a8d
2 changed files with 13 additions and 4 deletions

View File

@ -36,7 +36,7 @@ class PostEditorBlock {
$this->initFrontend();
}
register_block_type('mailpoet/form-block-render', [
$this->wp->registerBlockType('mailpoet/form-block-render', [
'attributes' => [
'form' => [
'type' => 'number',
@ -63,12 +63,12 @@ class PostEditorBlock {
Env::$version
);
register_block_type('mailpoet/form-block', [
$this->wp->registerBlockType('mailpoet/form-block', [
'style' => 'mailpoetblock-form-block-css',
'editor_script' => 'mailpoet/form-block',
]);
add_action('admin_head', function() {
$this->wp->addAction('admin_head', function() {
$forms = $this->formsRepository->findAllNotDeleted();
?>
<script type="text/javascript">
@ -84,7 +84,7 @@ class PostEditorBlock {
}
private function initFrontend() {
register_block_type('mailpoet/form-block', [
$this->wp->registerBlockType('mailpoet/form-block', [
'render_callback' => [$this, 'renderForm'],
]);
}