Metatag config entities should list appropriate module dependencies

Created on 1 April 2020, over 4 years ago
Updated 15 January 2024, 11 months ago

Problem/Motivation

If you create a metatag default config entity for a given content type, the config entity doesn't declare its dependency on that content-type or even on the node module 😡

e.g. given this default for an event content-type

uuid: 45df9c04-9030-40c4-b361-52d2690e5bbb
langcode: en
status: true
dependencies: {  }
id: node__event
label: 'Content: Event'
tags:
  description: '[node:summary]'
  title: '[node:title] | [site:name]'
  og_type: Event
  og_description: '[node:summary]'
  og_site_name: '[site:name]'
  og_url: '[node:url]'
  og_title: '[node:title]'

There is no dependency on node module or event content-type.

Proposed resolution

Implement core's config dependency API so that config integrity is enforced

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

πŸ› Bug report
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡¦πŸ‡ΊAustralia larowlan πŸ‡¦πŸ‡ΊπŸ.au GMT+10

Live updates comments and jobs are added and updated live.
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.

  • πŸ‡ΊπŸ‡ΈUnited States thejimbirch Cape Cod, Massachusetts

    I just ran into this while exporting metatag defaults for use in Drupal recipes. As @larowlan stated, the config doesn't any dependencies which could lead to failures.

    In my example:

    langcode: en
    status: true
    dependencies: {  }
    id: node__post
    label: 'Content: Post'
    tags:
      article_author: '[node:sa_author]'
      article_modified_time: '[node:changed:custom:c]'
      article_published_time: '[node:published:custom:c]'
      author: '[node:sa_author]'
      canonical_url: '[current-page:url:absolute]'
      description: '[node:sa_description|node:sa_seo_description|node:summary]'
      image_src: '[node:sa_featured_image:entity:field_media_image:sa_social_media_facebook]'
      og_description: '[node:sa_description|node:sa_seo_description|node:summary]'
      og_image: '[node:sa_featured_image:entity:field_media_image:sa_social_media_facebook]'
      og_image_alt: '[node:sa_featured_image:entity:field_media_image:alt]'
      og_image_height: '[node:sa_featured_image:entity:field_media_image:sa_social_media_facebook:height]'
      og_image_type: '[node:sa_featured_image:entity:field_media_image:sa_social_media_facebook:mimetype]'
      og_image_width: '[node:sa_featured_image:entity:field_media_image:sa_social_media_facebook:width]'
      og_locale: en_US
      og_site_name: '[site:name]'
      og_title: '[node:sa_seo_page_title|node:title]'
      og_type: article
      og_updated_time: '[node:changed:custom:c]'
      og_url: '[current-page:url:absolute]'
      referrer: unsafe-url
      rights: 'Copyright Β©[date:html_year] All rights reserved.'
      schema_article_author: 'a:3:{s:5:"@type";s:6:"Person";s:4:"name";s:16:"[node:sa_author]";s:3:"url";s:24:"[node:sa_author_url:uri]";}'
      schema_article_date_modified: '[node:changed:custom:c]'
      schema_article_date_published: '[node:published:custom:c]'
      schema_article_description: '[node:sa_description|node:sa_seo_description|node:summary]'
      schema_article_headline: '[node:sa_seo_page_title|node:title]'
      schema_article_id: '[current-page:url:absolute]'
      schema_article_image: 'a:5:{s:5:"@type";s:11:"ImageObject";s:20:"representativeOfPage";s:4:"True";s:3:"url";s:78:"[node:sa_featured_image:entity:field_media_image:sa_social_media_facebook:url]";s:5:"width";s:80:"[node:sa_featured_image:entity:field_media_image:sa_social_media_facebook:width]";s:6:"height";s:81:"[node:sa_featured_image:entity:field_media_image:sa_social_media_facebook:height]";}'
      schema_article_main_entity_of_page: '[current-page:url:absolute]'
      schema_article_name: '[node:sa_seo_page_title|node:title]'
      schema_article_type: Article
      title: '[node:sa_seo_page_title|node:title] | [site:name]'
      twitter_cards_description: '[node:sa_description|node:sa_seo_description|node:summary]'
      twitter_cards_image: '[node:sa_featured_image:entity:field_media_image:sa_social_media_x:url]'
      twitter_cards_image_alt: '[node:sa_featured_image:entity:field_media_image:alt]'
      twitter_cards_title: '[node:sa_seo_page_title|node:title]'
      twitter_cards_type: summary_large_image

    My config should have dependencies for:

    dependencies:
      config:
        - node.type.post
      module:
        - metatag
        - metatag_open_graph
        - metatag_twitter_cards
        - node
        - schema_article
        - schema_metatag
    

    And this is probably not possible, but I also have dependencies on token_or, media, image for modules and a bunch of field configs. If those things weren't there the metatags wouldn't be broken though, so that is probably more of a "content" problem.

  • πŸ‡ΊπŸ‡ΈUnited States DamienMcKenna NH, USA

    Let's make this a new feature.

  • πŸ‡§πŸ‡ͺBelgium wim leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί

    Isn't this a bug? πŸ˜…

  • πŸ‡ΊπŸ‡ΈUnited States DamienMcKenna NH, USA

    Yeah..

Production build 0.71.5 2024