I'm using the Mulitvalue Field module (https://www.drupal.org/project/multivaluefield) and I created a form like this and it successfully sets the various emails into the configuration file, but when i try to get the default value it, gets an array back. how do i get the default value for this multivalue field to display it in the form?
$form['comment']['comment_admin_notify_mailto'] = array(
'#type' => 'multivalue',
'#title' => $this->t('Comments Topics And Post Approvers'),
'#cardinality' => MultiValue::CARDINALITY_UNLIMITED,
'comment_admin_notify_mailto' => [
'#type' => 'textfield',
'#title' => $this->t('Person to send notifications for Comments, Topics and Posts'),
'#default_value' => vista_moderation_admin_notify_variable_get_site_email(),
],
);
this is the function code:
function vista_moderation_admin_notify_variable_get_site_email() {
$moderation_config = \Drupal::config('vista_moderation_admin_notify.settings');
$site_mail = $moderation_config->get('comment_admin_notify_mailto');
if (empty($site_mail)) {
$site_config = \Drupal::config('system.site');
$site_mail = $site_config->get('mail');
}
return $site_mail;