Skip to content
Snippets Groups Projects
Commit a26a24c8 authored by Ide Braakman's avatar Ide Braakman Committed by Dan Ruscoe
Browse files

Issue #2829777 by benstjohn, idebr: Translate Radio and Select fields from mc

parent 60f30602
No related branches found
Tags 8.x-2.0-alpha1
No related merge requests found
......@@ -1509,10 +1509,6 @@ function mailchimp_interest_groups_form_elements($list, $defaults = array(), $em
// Extract the field options:
$options = array();
if ($field_type == 'select') {
$options[''] = '-- select --';
}
$default_values = array();
// Set interest options and default values.
......@@ -1535,6 +1531,7 @@ function mailchimp_interest_groups_form_elements($list, $defaults = array(), $em
'#type' => $field_type,
'#title' => $group->title,
'#options' => $options,
'#empty_option' => t('-- select --'),
'#default_value' => isset($default_values[$group->id]) ? $default_values[$group->id] : array(),
'#attributes' => array('class' => array('mailchimp-newsletter-interests-' . $list->id)),
);
......
......@@ -66,6 +66,29 @@ class MailchimpI18nStringObjectWrapper extends i18n_string_object_wrapper {
$strings[$this->get_textgroup()]['mailchimp_signup'][$this->object->name] = array();
}
if (!empty($this->object->settings['include_interest_groups'])) {
$lists = mailchimp_get_lists($this->object->mc_lists);
if (!empty($lists)) {
foreach ($lists as $list) {
foreach ($list->intgroups as $intgroup) {
$properties['intgroup_' . $intgroup->id] = array(
'title' => $intgroup->title,
'string' => $intgroup->title,
);
if (!empty($intgroup->interests)) {
foreach ($intgroup->interests as $interest) {
$properties['intgroup_' . $intgroup->id . '_interest_' . $interest->id] = array(
'title' => $interest->name,
'string' => $interest->name,
);
}
}
}
}
}
}
$strings[$this->get_textgroup()]['mailchimp_signup'][$this->object->name] += $properties;
return $strings;
}
......
......@@ -300,6 +300,12 @@ function mailchimp_signup_subscribe_form($form, &$form_state, $signup, $type) {
),
);
$form['mailchimp_lists'][$wrapper_key]['interest_groups'] += mailchimp_interest_groups_form_elements($list);
foreach ($form['mailchimp_lists'][$wrapper_key]['interest_groups'] as $group_id => $group) {
$form['mailchimp_lists'][$wrapper_key]['interest_groups'][$group_id]['#title'] = mailchimp_signup_tt("mailchimp_signup:mailchimp_signup:$signup->name:intgroup_$group_id", $group['#title']);
foreach ($group['#options'] as $interest_id => $interest_name) {
$form['mailchimp_lists'][$wrapper_key]['interest_groups'][$group_id]['#options'][$interest_id] = mailchimp_signup_tt('mailchimp_signup:mailchimp_signup:' . $signup->name . ':intgroup_' . $group_id . '_interest_' . $interest_id, $interest_name);
}
}
}
}
}
......@@ -308,6 +314,12 @@ function mailchimp_signup_subscribe_form($form, &$form_state, $signup, $type) {
if ($use_interest_groups && isset($list->intgroups)) {
$form['mailchimp_lists']['#weight'] = 9;
$form['mailchimp_lists']['interest_groups'] = mailchimp_interest_groups_form_elements($list);
foreach ($form['mailchimp_lists']['interest_groups'] as $group_id => $group) {
$form['mailchimp_lists']['interest_groups'][$group_id]['#title'] = mailchimp_signup_tt("mailchimp_signup:mailchimp_signup:$signup->name:intgroup_$group_id", $group['#title']);
foreach ($group['#options'] as $interest_id => $interest_name) {
$form['mailchimp_lists']['interest_groups'][$group_id]['#options'][$interest_id] = mailchimp_signup_tt('mailchimp_signup:mailchimp_signup:' . $signup->name . ':intgroup_' . $group_id . '_interest_' . $interest_id, $interest_name);
}
}
}
}
$form['mergevars'] = array(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment