Form.php
6 months ago
Newsletter.php
6 months ago
Submission.php
5 months ago
Submission_Listener.php
6 months ago
Newsletter.php
21 lines
| 1 | <?php |
| 2 | |
| 3 | namespace IAWP\Form_Submissions; |
| 4 | |
| 5 | use IAWPSCOPED\Illuminate\Support\Collection; |
| 6 | /** @internal */ |
| 7 | class Newsletter |
| 8 | { |
| 9 | public static function get_form(?string $referrer) : ?array |
| 10 | { |
| 11 | if (\is_null($referrer)) { |
| 12 | return null; |
| 13 | } |
| 14 | return Collection::make(self::get_forms())->first(fn($form) => $form['referrer'] === $referrer); |
| 15 | } |
| 16 | private static function get_forms() : array |
| 17 | { |
| 18 | return [['id' => 1, 'title' => \__('Standard Form', 'independent-analytics'), 'referrer' => ''], ['id' => 2, 'title' => \__('After Post Content', 'independent-analytics'), 'referrer' => 'posts_bottom'], ['id' => 3, 'title' => \__('Popup', 'independent-analytics'), 'referrer' => 'popup'], ['id' => 4, 'title' => \__('Minimal Form', 'independent-analytics'), 'referrer' => 'minimal']]; |
| 19 | } |
| 20 | } |
| 21 |