} else { if (empty($mailchimplists)) { $mailchimplists = array('' => get_string('no_lists', 'block_mailchimp')); $strheader = "<p><b>" . get_string("missing_mailing_lists", 'block_mailchimp') . "</b></p>"; } } if ($mailchimpinterests === false) { $mailchimpinterests = array(); $strheader = "<p><b>" . get_string("error:load_interests", 'block_mailchimp') . "</b></p>"; // If we simply have no interests in mailchimp yet. } else { if (empty($mailchimpinterests)) { $mailchimpinterests = array('' => get_string('no_interests', 'block_mailchimp')); $strheader = "<p><b>" . get_string("missing_interests", 'block_mailchimp') . "</b></p>"; } } // Block name. $settings->add(new admin_setting_configtext('block_mailchimp_title', get_string("title", 'block_mailchimp'), get_string("config:title_description", 'block_mailchimp'), get_string('blockname', 'block_mailchimp'))); // Api code. // We're using custom admin settings cause we want to use some validation. $settings->add(new \block_mailchimp\setting\apikey('block_mailchimp_apicode', get_string("apicode", 'block_mailchimp') . $helpbuttonapicode, get_string("config:api_code_description", 'block_mailchimp'), '')); if (!($mailchimpprofilefields = \block_mailchimp\helper::get_chipmail_profile_fields())) { $mailchimpprofilefields = array('' => get_string('no_profile_fields', 'block_mailchimp')); } // List id. $settings->add(new admin_setting_configselect('block_mailchimp_listid', get_string("listid", 'block_mailchimp') . $helpbuttonapilists, get_string("config:api_list_description", 'block_mailchimp'), ' ', $mailchimplists)); // Interest name. $settings->add(new admin_setting_configselect('block_mailchimp_interest', get_string("interest", 'block_mailchimp') . $helpbuttoninterest, get_string("config:interest_description", 'block_mailchimp'), ' ', $mailchimpinterests)); // Profile field. $settings->add(new admin_setting_configselect('block_mailchimp_linked_profile_field', get_string("linked_profile_field", 'block_mailchimp') . $helpbuttonprofilefield, get_string("config:linked_profile_field_description", 'block_mailchimp'), ' ', $mailchimpprofilefields)); }