loadAcyMailing(); parent::__construct( 'acym_archive_widget', acym_translationSprintf('ACYM_MENU', acym_translation('ACYM_MENU_ARCHIVE')), ['description' => acym_translation('ACYM_MENU_ARCHIVE_DESC')] ); } //Widget Configuration public function form($instance) { $this->loadAcyMailing(); $params = [ 'title' => 'See all newsletters', 'lists' => '', 'popup' => true, 'displayUserListOnly' => true, 'nbNewslettersPerPage' => '10', ]; $listClass = new ListClass(); $lists = $listClass->getAllWithoutManagement(); foreach ($lists as $i => $oneList) { if ($oneList->active == 0) { unset($lists[$i]); } } foreach ($params as $keyParam => &$valueParam) { if (isset($instance[$keyParam])) { $valueParam = $instance[$keyParam]; } if (is_array($valueParam)) { $valueParam = implode(',', $valueParam); } if (in_array($keyParam, ['popup', 'displayUserListOnly'])) { $valueParam = (bool)$valueParam; } else { $valueParam = esc_attr($valueParam); } } echo '
'; echo '
'.wp_kses( acym_translationSprintf( 'ACYM_X_NEWSLETTERS_PER_PAGE', acym_select( [ '5' => '5', '10' => '10', '15' => '15', '20' => '20', '30' => '30', '50' => '50', '100' => '100', '200' => '200', ], $this->get_field_name('nbNewslettersPerPage'), $params['nbNewslettersPerPage'] ) ), [ 'select' => [ 'name' => true, 'id' => true, ], 'option' => [ 'value' => true, 'selected' => true, ], ] ).'
'; echo ''; acym_selectMultiple( $lists, $this->get_field_name('lists'), explode(',', $params['lists']), [ 'style' => 'width:100%;', 'id' => $this->get_field_id('lists'), ], 'id', 'name', true ); echo '
'; acym_boolean($this->get_field_name('popup'), $params['popup'], $this->get_field_id('popup')).'
'; echo ''; acym_boolean($this->get_field_name('displayUserListOnly'), $params['displayUserListOnly'], $this->get_field_id('displayUserListOnly')).'
'; echo '