Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
A remnant of the d6 form API persists in the following:
function webform_submission_resend($form, $form_state, $node, $submission) {
...
$form['emails'][$eid]['email'] = array(
'#markup' => implode('<br />', $email_addresses),
);
if (!$valid_email) {
$form['emails'][$eid]['email']['#value'] .= ' (' . t('empty') . ')'; // SHOULD BE #markup
}
This both does not append the desired '(empty)' but throws a PHP notice.
It might be marginally better to do:
if (!$valid_email) {
$email_addresses[] = ' (' . t('empty') . ')';
}
$form['emails'][$eid]['email'] = array(
'#markup' => implode('<br />', $email_addresses),
);
or
$form['emails'][$eid]['email'] = array(
'#markup' => implode('<br />', $email_addresses) . ($valid_email ? '' : ' (' . t('empty') . ')'),
);
To avoid having to re-index into the $form array.
Comments
Comment #1
DanChadwick CreditAttribution: DanChadwick commentedFixed (at some point) in 4.x, which currently contains:
#value changed to #markup.
Thank you to whoever fixed this.
Comment #2
quicksketchAccording to git blame, you fixed it, in #1803702: Resend e-mail form w/ invalid e-mail address throws notice, doesn't add " (empty)" as intended. :)
http://drupalcode.org/project/webform.git/commit/f57fdf4cb46187119119441...
Comment #3
quicksketchAnother apology for taking so long to review, you actually filed, fixed, and even closed the same issue twice. :( Still, I really appreciate the help. So, thanks!