Allow plugins to add their own context data for automation editor

[PREMIUM-215]
This commit is contained in:
Jan Jakes
2023-01-06 15:30:23 +01:00
committed by Aschepikov
parent 4ddcc14eee
commit 6b7ffbc4ad
6 changed files with 34 additions and 0 deletions

View File

@@ -83,6 +83,7 @@ class AutomationEditor {
$roles = new \WP_Roles();
$this->pageRenderer->displayPage('automation/editor.html', [
'registry' => $this->buildRegistry(),
'context' => $this->buildContext(),
'automation' => $this->automationMapper->buildAutomation($automation),
'sub_menu' => 'mailpoet-automation',
'api' => [
@@ -108,4 +109,12 @@ class AutomationEditor {
}
return ['steps' => $steps];
}
private function buildContext(): array {
$data = [];
foreach ($this->registry->getContextFactories() as $key => $factory) {
$data[$key] = $factory();
}
return $data;
}
}