/** * Load the form * * @return void */ private function loadForm() { // create form $this->frm = new BackendForm('import'); // fetch the groups $this->externalGroups = $this->cm->getListsByClientId(); // loop the groups foreach ($this->externalGroups as &$group) { // add subscribers + count to the group stack $group['subscribers'] = BackendMailmotorCMHelper::getSubscribers($group['id']); $group['subscribers_amount'] = count($group['subscribers']); // get the custom fields $customFields = $this->cm->getCustomFields($group['id']); // skip this if no custom fields were found if (!empty($customFields)) { // loop the custom fields foreach ($customFields as &$field) { // save only field name in a new format $field = $field['name']; } } // add custom fields to the group stack $group['custom_fields'] = empty($customFields) ? null : serialize($customFields); } // parse the groups $this->tpl->assign('groups', $this->externalGroups); }