Problem/Motivation

Drupal is moving towards attributes for plugin discovery, see https://www.drupal.org/project/drupal/issues/3396165

Proposed resolution

Convert plugin discovery to attributes

Remaining tasks

  1. Write a merge request
  2. Review
  3. Commit
  4. Write a change record and link it into the deprecated class

User interface changes

None

API changes

Schema Metatags plugins are now preferably declared through attributes

Data model changes

None

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

macsim created an issue. See original summary.

macsim’s picture

Issue summary: View changes

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

echechulina’s picture

Status: Active » Needs review
Issue tags: +Chicago2026

Added src/Attribute/SchemaPropertyType.phpextending AttributeBase, updated PropertyTypeManager to pass both the attribute and annotation classes to DefaultPluginManager for dual-mode discovery, and added #[SchemaPropertyType(...)] attributes to all 43 PropertyType plugins. Existing @SchemaPropertyType() docblock annotations are kept for backward compatibility.

Branch: 3562631-convert-plugin-types

macsim’s picture

Thanks for the MR

Few comments:

  • MR should target 3.0.x-dev instead of 8.x-2.x
  • It provides more than what was requested (do we need these changes in gitlab CI? do we need cspell words to be reodered alphabetically? do we need the strict types to be enabled?) - we could address those questions in other dedicated issues
  • PHP 8 is supported from Drupal 9.1.0 but the module is compatible with drupal 9.0 (composer.json and schema_metatag.info.yml).
    Since Drupal 9 has reached its EOL, I suggest dropping drupal 9 support (but it's up to a schema_metatag maintainer to take that decision).

Leaving the Needs review status for maintainers.

damienmckenna’s picture

Status: Needs review » Needs work

Yes, the MR should target 3.0.x, the 8.x-2.x branch is minimally unsupported.

Metatag requires 10.3, so it's ok for Schema Metatag to do likewise.

It might be easiest to recreate the MR from scratch using 3.0.x and not including irrelevant changes.

macsim changed the visibility of the branch 3562631-convert-plugin-types to hidden.

macsim changed the visibility of the branch 3577056-unnecessarily-hex-encoded-characters to hidden.

macsim’s picture

  • New MR targeting 3.0.x with a lot of echechulina's work
  • Updated the module compatibility in composer.json and schema_metatag.info.yml to require at least drupal 10.3, metatag 2.2 and therefore PHP8.1


Submodules also need some updates to use metatag attributes.
metatag module doesn't provide attributes yet.

macsim’s picture

Status: Needs work » Needs review

Seems like everything needed is in.
We also will need to update Group and Tag definitions in sub-modules but that can be done in another issue and would need following issues to be released

Edit: We should introduce a @deprecated in %deprecation-version% and is removed from %removal-version% + @see %cr-link% in Drupal\schema_metatag\Annotation\SchemaPropertyType phpdoc.
I didn't did it cause I am not sure about the versions numbers.
Up to the maintainers,

  • %deprecation-version% could be something like 3.0.5 or 3.1.0
  • %removal-version% could be something like 3.1.0 or 4.0.0
  • %cr-link% would be a link to the change record explaining that the plugin discovery is now based on php attributes
macsim’s picture

Issue summary: View changes
damienmckenna’s picture

Thank you for your work on this, macsim, we'll review it and get it finished off for the next release.