| @@ -1,16 +1,20 @@ | ||
| 1 | 1 | <?php |
| 2 | +defined('ABSPATH') || die('Restricted Access'); | |
| 2 | 3 | |
| 3 | 4 | use AcyMailing\Classes\ListClass; |
| 4 | 5 | |
| 5 | 6 | include_once __DIR__.DIRECTORY_SEPARATOR.'AcymJFormField.php'; |
| 6 | 7 | |
| 8 | +// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound -- Joomla specific class naming with imposed prefix "JFormField". | |
| 7 | 9 | class JFormFieldLists extends AcymJFormField |
| 8 | 10 | { |
| 9 | - var $type = 'lists'; | |
| 11 | + public function __construct($form = null) | |
| 12 | + { | |
| 13 | + $this->type = 'lists'; | |
| 14 | + parent::__construct($form); | |
| 15 | + } | |
| 10 | 16 | |
| 11 | - public $value; | |
| 12 | - | |
| 13 | 17 | public function getInput() |
| 14 | 18 | { |
| 15 | 19 | |
| 16 | 20 | $listClass = new ListClass(); |
| @@ -20,9 +24,10 @@ | ||
| 20 | 24 | unset($lists[$i]); |
| 21 | 25 | } |
| 22 | 26 | } |
| 23 | 27 | |
| 24 | - if (ACYM_CMS == 'joomla' && $this->value == 'All' && !empty($this->form)) { | |
| 28 | + // In Joomla, when the user chooses to empty a field, it sets the default value of this field... that's not what we want | |
| 29 | + if (ACYM_CMS == 'joomla' && $this->value === 'All' && !empty($this->form)) { | |
| 25 | 30 | $formId = $this->form->getData()->get('id'); |
| 26 | 31 | if (!empty($formId)) { |
| 27 | 32 | $this->value = ''; |
| 28 | 33 | } |