AbstractAutomationEmbed.php
5 months ago
Automation.php
2 years ago
AutomationAnalytics.php
2 months ago
AutomationEditor.php
2 months ago
AutomationFlowEmbed.php
6 months ago
AutomationPreviewEmbed.php
2 months ago
AutomationTemplates.php
2 years ago
CustomFields.php
2 months ago
DynamicSegments.php
2 months ago
ExperimentalFeatures.php
3 years ago
FormEditor.php
1 week ago
Forms.php
2 months ago
Help.php
2 months ago
Homepage.php
2 years ago
Landingpage.php
2 years ago
Logs.php
1 month ago
NewsletterEditor.php
2 months ago
Newsletters.php
2 months ago
Settings.php
5 months ago
StaticSegments.php
2 months ago
Subscribers.php
1 week ago
SubscribersExport.php
3 years ago
SubscribersImport.php
2 months ago
Tags.php
2 months ago
Upgrade.php
1 year ago
WelcomeWizard.php
2 months ago
WooCommerceSetup.php
2 months ago
index.php
3 years ago
CustomFields.php
57 lines
| 1 | <?php declare(strict_types = 1); |
| 2 | |
| 3 | namespace MailPoet\AdminPages\Pages; |
| 4 | |
| 5 | if (!defined('ABSPATH')) exit; |
| 6 | |
| 7 | |
| 8 | use MailPoet\AdminPages\AssetsController; |
| 9 | use MailPoet\AdminPages\PageRenderer; |
| 10 | use MailPoet\Form\Block\Date; |
| 11 | use MailPoet\WP\Functions as WPFunctions; |
| 12 | |
| 13 | class CustomFields { |
| 14 | /** @var AssetsController */ |
| 15 | private $assetsController; |
| 16 | |
| 17 | /** @var PageRenderer */ |
| 18 | private $pageRenderer; |
| 19 | |
| 20 | /** @var WPFunctions */ |
| 21 | private $wp; |
| 22 | |
| 23 | /** @var Date */ |
| 24 | private $dateBlock; |
| 25 | |
| 26 | public function __construct( |
| 27 | AssetsController $assetsController, |
| 28 | PageRenderer $pageRenderer, |
| 29 | WPFunctions $wp, |
| 30 | Date $dateBlock |
| 31 | ) { |
| 32 | $this->assetsController = $assetsController; |
| 33 | $this->pageRenderer = $pageRenderer; |
| 34 | $this->wp = $wp; |
| 35 | $this->dateBlock = $dateBlock; |
| 36 | } |
| 37 | |
| 38 | public function render(): void { |
| 39 | $this->assetsController->setupCustomFieldsDependencies(); |
| 40 | $dateTypes = $this->dateBlock->getDateTypes(); |
| 41 | $this->pageRenderer->displayPage('subscribers/custom_fields.html', [ |
| 42 | 'api' => [ |
| 43 | 'root' => rtrim($this->wp->escUrlRaw($this->wp->restUrl()), '/'), |
| 44 | 'nonce' => $this->wp->wpCreateNonce('wp_rest'), |
| 45 | ], |
| 46 | 'date_types' => array_map(function ($label, $value) { |
| 47 | return [ |
| 48 | 'label' => $label, |
| 49 | 'value' => $value, |
| 50 | ]; |
| 51 | }, $dateTypes, array_keys($dateTypes)), |
| 52 | 'date_formats' => $this->dateBlock->getDateFormats(), |
| 53 | 'subscribers_listing_url' => $this->wp->escUrlRaw($this->wp->adminUrl('admin.php?page=mailpoet-subscribers')), |
| 54 | ]); |
| 55 | } |
| 56 | } |
| 57 |