Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When generating tokens for an addressfield that has the country hidden set as an option, the only data provided is the mode:
Line 140 in addressfield.tokens.inc:
$form = addressfield_generate($address, $data['format_handlers'], array('mode' => 'form'));
However, the module wants more information:
function addressfield_format_address_hide_country(&$format, $address, $context = array()) {
// Hide the country element only if the whole field is required, otherwise
// there will always be an additional None option.
if ($context['mode'] == 'form' && $context['instance']['required']) {
So if instance isn't provided, it throws a notice.
Comment | File | Size | Author |
---|---|---|---|
#3 | undefined_index-2587621-3.patch | 807 bytes | nvahalik |
Comments
Comment #2
nvahalik CreditAttribution: nvahalik at Centarro commentedComment #3
nvahalik CreditAttribution: nvahalik at Centarro commentedComment #4
skwashd CreditAttribution: skwashd at Dave Hall Consulting commentedI am running 7.x-1.2 which includes #2391989: Notice: Undefined index: instance. I am seeing this error.
Applying @nvahalik's patch from #3 fixes it. The code looks good to me. RTBC
Comment #5
bojanz CreditAttribution: bojanz commentedCommitted, thanks.