function newsletter_field_attach_form in Newsletter 7
Implements hook_field_attach_form().
File
- ./
newsletter.module, line 864 - Defines menu items for newsletter administration, permissions and basic drupal hooks.
Code
function newsletter_field_attach_form($entity_type, $entity, &$form, &$form_state, $langcode) {
if ($entity_type == 'newsletter_subscriber') {
$lang = $form['field_newsletter_list']['#language'];
$list_ids = array_keys($form['field_newsletter_list'][$lang]['#options']);
$lists = newsletter_list_load($list_ids);
$exposed_lists = newsletter_exposed_lists();
foreach ($lists as $list) {
if (in_array($list->nlid, $exposed_lists)) {
$form['exposed']['exposed_' . $list->nlid] = array(
'#type' => 'checkboxes',
'#options' => newsletter_get_template_terms($list->field_newsletter_template[$lang][0]['target_id']),
'#title' => t("@list's Configuration", array(
'@list' => $list->title,
)),
'#default_value' => newsletter_get_default_exposed($entity, $list),
);
}
}
}
}