The NodeJsonOutput tests are currently failing, e.g. https://www.drupal.org/pift-ci-job/752648. Fix this.

The MetatagNormalizer::normalize() method assumes that all meta tags have a "content" attribute because it does this:

foreach ($tags['#attached']['html_head'] as $tag) {
$normalized['value'][$tag[1]] = $tag[0]['#attributes']['content'];
}
Obviously not all meta tags have a "content" element, e.g. LINK tags actually use the "href" attribute.

When the above code is running the $tag array will look something like this:

Array (
    [0] => Array (
        [#tag] => link
        [#attributes] => Array (
            [rel] => canonical
            [href] => http://replacements.mcdev/myaccount/304548
        )
    )
    [1] => canonical_url
)

I think we're going to need to add some logic to load the appropriate class based upon $tag[1] and use it to identify what the "value" is.

Of course this won't work if the meta tag has multiple "values", e.g. MaskIcon.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

DamienMcKenna created an issue. See original summary.

DamienMcKenna’s picture

Title: Fix NodeJsonOutput tests » Normalizer assumes all meta tags have a "content" attribute
Category: Task » Bug report
Issue summary: View changes

So it turns out that the bug is a problem in the normalizer.

DamienMcKenna’s picture

Issue summary: View changes
DamienMcKenna’s picture

Status: Active » Needs review
FileSize
1019 bytes

This makes the normalizer support "content" and "href" attributes, but it'll require further work to do a proper fix.

DamienMcKenna’s picture

  • DamienMcKenna committed e4f7541 on 8.x-1.x
    Issue #2905925 by DamienMcKenna: The Normalizer shouldn't assume all...
DamienMcKenna’s picture

Status: Needs review » Fixed

Committed.

Status: Fixed » Closed (fixed)

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