Problem/Motivation

I have plenty PHP warnings when using the Metatag module, I think it is because the field storage may be special.

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

grimreaper created an issue. See original summary.

pdureau’s picture

pdureau’s picture

Title: PHP warnings with Metatag module » [2.0.0-rc2] PHP warnings with Metatag module
christian.wiedemann’s picture

Assigned: Unassigned » christian.wiedemann
christian.wiedemann’s picture

Hi,
I can't reproduce this bug. I installed metatag and checked the field storage for field_metatag and the computed metatag. Any hint how I can that reproduce

christian.wiedemann’s picture

Status: Active » Postponed (maintainer needs more info)
pdureau’s picture

grimreaper’s picture

I have the warnings on the MR of #3485615: [10.1.x] Upgrade to UIP2.

But currently the installation is blocked by #3498496: [2.0.0-rc2] Context error during installation , so I will try to reproduce on a standard install.

grimreaper’s picture

Got a clue.

It is for some specific entity_type.

Related to:
- core.base_field_override.shortcut.default.metatag
- core.base_field_override.simple_mega_menu.default.metatag
- core.base_field_override.user.user.metatag

These 3 config twice at each cache clear.

I tried to reproduce on a fresh install. See screenshot of /admin/config/regional/content-language.

But I don't know why on my fresh install, the config is saved, but when I export the config, there is no core.base_field_override.shortcut.default.metatag file.

I will try to go deeper tomorrow.

But then maybe it is legacy Metatag stuff in Sobki's config.

grimreaper’s picture

Assigned: grimreaper » Unassigned
Status: Postponed (maintainer needs more info) » Closed (works as designed)

I think I found it.

On my fresh install I had been able to get a core.base_field_override.user.user.metatag

uuid: efad82a6-6b28-4c79-9766-25a1dffadff7
langcode: en
status: true
dependencies:
  module:
    - metatag
    - user
id: user.user.metatag
field_name: metatag
entity_type: user
bundle: user
label: 'Metatags (Hidden field for JSON support)'
description: 'The computed meta tags for the entity.'
required: false
translatable: true
default_value: {  }
default_value_callback: ''
settings: {  }
field_type: metatag_computed

Whereas on Sobki it looks like:

uuid: fdac8baf-39e4-4353-8669-814967182c14
langcode: en
status: true
dependencies:
  module:
    - user
_core:
  default_config_hash: BggQQmc05YzF3dnZzbHBRHsnGQotgHAkAPzNLtewF3I
id: user.user.metatag
field_name: metatag
entity_type: user
bundle: user
label: 'Metatags (Hidden field for JSON support)'
description: 'The meta tags for the entity.'
required: false
translatable: false
default_value: {  }
default_value_callback: ''
settings: {  }
field_type: map

The field type is not the same.

So I guess it is a Metatag update that had not been correctly applied or a missing update in the Metatag module.

grimreaper’s picture

Status: Closed (works as designed) » Active

Nope.

I have deleted my config. Resaved /admin/config/regional/content-language, so it had been recreated for simple_mega_menu and user (not for shortcut like on my other fresh install website).

Recreated with "field_type: metatag_computed" for both user and simple_mega_menu but now the warning is in the previous foreach.

 foreach ($entity_type_fields_data["field_storages"] as $field_name => $field_storage_data) {
...
      $base_plugin_derivative = array_merge($base_plugin_definition, [
        'label' => $field_storage_data["label"],
grimreaper’s picture

On my fresh install website I don't pass in app/core/lib/Drupal/Component/Plugin/Discovery/DerivativeDiscoveryDecorator.php for field property derivative.

pdureau’s picture

Assigned: Unassigned » christian.wiedemann
pdureau’s picture

grimreaper’s picture

Title: [2.0.0-rc2] PHP warnings with Metatag module » [2.0.0-rc2] PHP warnings with computed fields

grimreaper’s picture

Assigned: grimreaper » christian.wiedemann
Status: Active » Needs work

So, happening not only with Metatag, but with other computed fields like path, menu_link, default_revision and customer_profiles (commerce).

Not sure if this is the proper fix, if there is a better place to act, or better to change the foreach loop directly. But at least, I don't have warnings anymore.

And for the warnings to happen, I had to use a component as a layout in my display and trigger this display. The component can be left empty of slots/props.

christian.wiedemann’s picture

Hi, now I fixed the problems during installation which are related to UI Patterns. This also fixes:
https://www.drupal.org/project/ui_patterns/issues/3498496

I also add these two composer patches which fixes core issues.

"drupal/core": {
"Media Library: Argument #1 ($array) must be of type array, null given in array_filter().": "https://www.drupal.org/files/issues/2023-12-01/3340973-33.patch",
          "Warning: \"extra_field_block:node:*:content_moderation_control\" was not found": "https://git.drupalcode.org/project/drupal/-/merge_requests/9793/diffs.diff",
}

We had two issues:

  • calculateDependencies instanciates Plugins. This throws errors during site install. In discussion with Mikael I add a try catch.
  • The warnings occurs because getFieldMap is not up to date. Core has the same problem See: https://www.drupal.org/project/drupal/issues/3176461

Two problems still exists.

  • Field user_picture crashes. This happens in SiteConfigurationForm::354;
  • it seems that default content content installation crashes .
christian.wiedemann’s picture

Status: Needs work » Needs review
pdureau’s picture

Let's talk about that tomorrow

grimreaper’s picture

Assigned: grimreaper » christian.wiedemann
Status: Needs review » Reviewed & tested by the community

Thanks for the fixes!

Once pipeline is green. Ok to merge on my opinion.

pdureau’s picture

Status: Reviewed & tested by the community » Needs work

Pipeline fixes

christian.wiedemann’s picture

Status: Needs work » Needs review
pdureau’s picture

Status: Needs review » Reviewed & tested by the community

Auto merge.

  • pdureau committed 579a85aa on 2.0.x authored by grimreaper
    Issue #3498456 by christian.wiedemann, grimreaper, pdureau: PHP warnings...
christian.wiedemann’s picture

Assigned: christian.wiedemann » Unassigned
Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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

christian.wiedemann’s picture