PluginProbe
MailPoet – Newsletters, Email Marketing, and Automation / 3.59.2
MailPoet – Newsletters, Email Marketing, and Automation v3.59.2
5.38.0 5.37.0 5.36.1 5.36.0 5.35.1 5.35.0 5.34.3 5.34.2 5.34.1 5.34.0 5.33.1 5.33.0 5.32.0 5.31.0 5.30.0 5.29.0 5.28.1 5.28.0 5.27.0 5.26.0 5.26.1 5.25.0 5.24.0 4.43.0 4.43.1 All 542 releases
mailpoet / lib / Models / NewsletterOptionField.php

NewsletterOptionField.php in MailPoet – Newsletters, Email Marketing, and Automation 3.59.2, at lib/Models/NewsletterOptionField.php

37 lines 939 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace MailPoet\Models;
4
5 if (!defined('ABSPATH')) exit;
6
7
8 use MailPoet\WP\Functions as WPFunctions;
9
10 /**
11 * @property string $name
12 * @property string $newsletterType
13 */
14
15 class NewsletterOptionField extends Model {
16 public static $_table = MP_NEWSLETTER_OPTION_FIELDS_TABLE; // phpcs:ignore PSR2.Classes.PropertyDeclaration
17
18 public function __construct() {
19 parent::__construct();
20 $this->addValidations('name', [
21 'required' => WPFunctions::get()->__('Please specify a name.', 'mailpoet'),
22 ]);
23 $this->addValidations('newsletter_type', [
24 'required' => WPFunctions::get()->__('Please specify a newsletter type.', 'mailpoet'),
25 ]);
26 }
27
28 public function newsletters() {
29 return $this->has_many_through(
30 __NAMESPACE__ . '\Newsletter',
31 __NAMESPACE__ . '\NewsletterOption',
32 'option_field_id',
33 'newsletter_id'
34 )->select_expr(MP_NEWSLETTER_OPTION_TABLE . '.value');
35 }
36 }
37