tree_depth of 0 always returns all children

Created on 19 September 2023, over 1 year ago

Problem/Motivation

Steps to reproduce

Use hook_metatag_tags_alter() and set tree_depth to zero like in the example

function hook_metatag_tags_alter(array &$definitions) {
  // Set up the Schema Article tags to only display "NewsArticle" in the
  // `@type` option list.
  $definitions['schema_article_type']['property_type'] = 'type';
  $definitions['schema_article_type']['tree_parent'] = ['NewsArticle'];
  $definitions['schema_article_type']['tree_depth'] = 0;
}
All subitems will be returned instead of just NewsArticle

Proposed resolution

I believe that src/Plugin/metatag/Tag/SchemaNameBase.php should not check for empty for the tree_depth since it's an int and check for isset instead.

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

2.0

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024