Move Template Selection to a separate page

[MAILPOET-2987]
This commit is contained in:
Pavel Dohnal
2020-06-23 11:15:18 +02:00
committed by Veljko V
parent dcbb0d9381
commit 565da8b52e
5 changed files with 37 additions and 14 deletions

View File

@ -188,6 +188,26 @@ class Menu {
});
});
// form editor templates
$formTemplateSelectionEditorPage = $this->wp->addSubmenuPage(
true,
$this->setPageTitle(__('Form Editor', 'mailpoet')),
$this->wp->__('Form Editor', 'mailpoet'),
AccessControl::PERMISSION_MANAGE_FORMS,
'mailpoet-form-editor-template-selection',
[
$this,
'formEditorTemplateSelection',
]
);
// add body class for form editor page
$this->wp->addAction('load-' . $formTemplateSelectionEditorPage, function() {
$this->wp->addAction('admin_body_class', function ($classes) {
return ltrim($classes . ' block-editor-page');
});
});
// Subscribers page
$subscribersPage = $this->wp->addSubmenuPage(
@ -454,6 +474,10 @@ class Menu {
$this->container->get(FormEditor::class)->render();
}
public function formEditorTemplateSelection() {
$this->container->get(FormEditor::class)->renderTemplateSelection();
}
public function setPageTitle($title) {
return sprintf(
'%s - %s',