Use wp class intead of calling functions directly
[MAILPOET-1798]
This commit is contained in:
committed by
Jack Kitterhing
parent
5ad6016a60
commit
8da7330a8d
@ -36,7 +36,7 @@ class PostEditorBlock {
|
|||||||
$this->initFrontend();
|
$this->initFrontend();
|
||||||
}
|
}
|
||||||
|
|
||||||
register_block_type('mailpoet/form-block-render', [
|
$this->wp->registerBlockType('mailpoet/form-block-render', [
|
||||||
'attributes' => [
|
'attributes' => [
|
||||||
'form' => [
|
'form' => [
|
||||||
'type' => 'number',
|
'type' => 'number',
|
||||||
@ -63,12 +63,12 @@ class PostEditorBlock {
|
|||||||
Env::$version
|
Env::$version
|
||||||
);
|
);
|
||||||
|
|
||||||
register_block_type('mailpoet/form-block', [
|
$this->wp->registerBlockType('mailpoet/form-block', [
|
||||||
'style' => 'mailpoetblock-form-block-css',
|
'style' => 'mailpoetblock-form-block-css',
|
||||||
'editor_script' => 'mailpoet/form-block',
|
'editor_script' => 'mailpoet/form-block',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
add_action('admin_head', function() {
|
$this->wp->addAction('admin_head', function() {
|
||||||
$forms = $this->formsRepository->findAllNotDeleted();
|
$forms = $this->formsRepository->findAllNotDeleted();
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
@ -84,7 +84,7 @@ class PostEditorBlock {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private function initFrontend() {
|
private function initFrontend() {
|
||||||
register_block_type('mailpoet/form-block', [
|
$this->wp->registerBlockType('mailpoet/form-block', [
|
||||||
'render_callback' => [$this, 'renderForm'],
|
'render_callback' => [$this, 'renderForm'],
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@ -468,6 +468,15 @@ class Functions {
|
|||||||
return wp_enqueue_style($handle, $src, $deps, $ver, $media);
|
return wp_enqueue_style($handle, $src, $deps, $ver, $media);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string|\WP_Block_Type $name
|
||||||
|
* @param array $args {
|
||||||
|
* @return \WP_Block_Type|false
|
||||||
|
*/
|
||||||
|
public function registerBlockType($name, $args = []) {
|
||||||
|
return register_block_type($name, $args);
|
||||||
|
}
|
||||||
|
|
||||||
public function wpGetAttachmentImageSrc($attachmentId, $size = 'thumbnail', $icon = false) {
|
public function wpGetAttachmentImageSrc($attachmentId, $size = 'thumbnail', $icon = false) {
|
||||||
return wp_get_attachment_image_src($attachmentId, $size, $icon);
|
return wp_get_attachment_image_src($attachmentId, $size, $icon);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user