/** * load the form */ private function loadForm() { // check if user is almighty $this->isGod = BackendAuthentication::getUser()->isGod(); // create form instance $this->frm = new BackendForm('settings'); // fetch module settings $this->settings = BackendModel::getModuleSettings('Mailchimp'); // connect to mailchimp and get the lists $mailchimp = $this->getContainer()->get('zfr_mail_chimp')->getClient(); $lists = $mailchimp->getLists(); // loop the lists and add to key value array $listItems = array(); if ($lists['total'] > 0) { foreach ($lists['data'] as $l) { $listItems[$l['id']] = $l['name']; } } // add the formfields $this->frm->addDropdown('list', $listItems, $this->settings['activeList']); }