Allow parent config to override empty values of more specific config

Created on 18 July 2013, almost 11 years ago
Updated 4 October 2023, 9 months ago

Starting this as a support request.

If I have a global OG image tag outputting a default site image and then for my content types I have a more specific tag that uses the image in an image field.

If that image field has no image in it I get no OG image tag.

I think it would be useful in this case for the global image to override the empty value.

Now I understand maybe not everyone wants this behaviour but maybe it could be optional as I think a lot of people would want it for things like this image tag.

For a start, is this behaviour currently possible? It seems like it is not.

✨ Feature request
Status

Needs review

Version

1.0

Component

Code

Created by

🇦🇺Australia rooby

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇲🇾Malaysia ckng

    Tested patch #55, works well.

  • 🇮🇹Italy dgsiegel

    Patch #55 does not seem to work with a headless approach. Metatags will be saved in the computed field. In a normal approach, where Drupal is rendering the output, the patch overwrites empty tags with global defaults:

            // Merge with global defaults.
            if (strpos($route_name, 'canonical') !== FALSE) {
              $metatags->overwriteTags(metatag_filter_empty_tokens($entity_metatags->get('tags'), $entity));
            }

    However when saving to the computed field, the route is not canonical and so global defaults are left untouched. When accessing JSON:API, only the computed field gets accessed and no merge can happen at that time.

  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.5 + Environment: PHP 7.3 & MySQL 5.7
    last update 9 months ago
    374 pass
  • 🇺🇦Ukraine alt.dev

    I confirm that the patch doesn't work with the JSON:API module.

    I updated the latest patch and added the fix for the computed field.

Production build 0.69.0 2024