Problem/Motivation

Upgrading from 1.12 to 2.01 caused a fatal error: Fatal error: Could not check compatibility between Drupal\address\Plugin\Field\FieldFormatter\AddressDefaultFormatter::settingsForm(array $form, Drupal\address\Plugin\Field\FieldFormatter\FormStateInterface $form_state) and Drupal\Core\Field\FormatterBase::settingsForm(array $form, Drupal\Core\Form\FormStateInterface $form_state), because class Drupal\address\Plugin\Field\FieldFormatter\FormStateInterface is not available in /var/www/html/web/modules/contrib/address/src/Plugin/Field/FieldFormatter/AddressDefaultFormatter.php on line 144

Steps to reproduce

Upgrade 1.12 to 2.01 using composer.
Add the address field to a content type.
View that content type and it will cause a fatal error.

Issue fork address-3443604

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

acemichael created an issue. See original summary.

Praveen rani’s picture

Assigned: Unassigned » Praveen rani
Praveen rani’s picture

Assigned: Praveen rani » Unassigned

rishabjasrotia made their first commit to this issue’s fork.

aimadbachar’s picture

Hello,

I attempted to replicate the fatal error, but I didn't encounter any issues. I utilized PHP 8.1.3, Drupal core 10.2.2, and Composer 2.2.6.

Could you please provide any specific steps you followed during the upgrade process? Additionally, if you have any screenshots or relevant code snippets, please feel free to share them.

Furthermore, it would be helpful if you could provide details about your environment, such as the versions of Composer, Drupal core, and PHP you're using.

Please don't hesitate to consult error logs or debug messages for further insights. I'm more than willing to offer further assistance to help resolve this issue, including exploring alternative solutions if necessary.

acemichael’s picture

StatusFileSize
new25.06 KB

Hello,

We are using Drupal 10.2.5, PHP 8.2.18 and Composer 2.7.4.
After upgrading we ran update.php and had these updates:

Module Update ID Type Description
--------- ------------------------ --------------- ------------------------
address 9201 hook_update_n 9201 - Add the
address_line3 field.
address default_widget_wrapper post-update Add the "Wrapper type"
setting to the default
widget.

We have a content type using the Address field and after upgrading and running update.php we got a fatal error when view that type.

Fatal error: Could not check compatibility between Drupal\address\Plugin\Field\FieldFormatter\AddressDefaultFormatter::settingsForm(array $form, Drupal\address\Plugin\Field\FieldFormatter\FormStateInterface $form_state) and Drupal\Core\Field\FormatterBase::settingsForm(array $form, Drupal\Core\Form\FormStateInterface $form_state), because class Drupal\address\Plugin\Field\FieldFormatter\FormStateInterface is not available in /var/www/html/web/modules/contrib/address/src/Plugin/Field/FieldFormatter/AddressDefaultFormatter.php on line 144

Let me know if you need any more info to replicate.

bojanz’s picture

AddressDefaultFormatter does not have a settingsForm() method in the 2.x branch:
https://git.drupalcode.org/project/address/-/blob/2.x/src/Plugin/Field/F...

It sounds like you are applying a patch which is incomplete (didn't add a use statement for the FormStateInterface).

acemichael’s picture

Yes, we were using this patch:
"Hide domestic country": "https://www.drupal.org/files/issues/2019-02-21/hide_domestic_country_275..."

Is there a way to hide domestic country in 2.01 ?

bojanz’s picture

Category: Bug report » Support request
Status: Active » Fixed

There you go then. You'll have to fix that patch (just add the use statement you're missing).

And no, that feature is not in 2.0.x yet.

EDIT: Looking at the MR for #2753899: Allow hiding display of country for domestic addresses it already has the use statement added, so you probably just need to update your patch.

rishabjasrotia’s picture

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

acemichael’s picture

Hi @rishabjasrotia,

Sorry for the delay!

We tried adding the latest patch to the 2.01 version and got a "Could not apply patch" error message.
Before upgrading to 2.01, we removed the old patch, then we upgraded the module, and then tried adding the latest patch.