Using Yoast SEO and Metatags, our description field gets filled with a WYSIWYG field value. This value is appearing with HTML, which is unwanted. And although the Metatags module filters that out on rendering the metatags, even showing this HTML in the node edit form is unwanted (in the Metatag field).

I will attach a patch that uses the Metatags built-in code to retrieve a metatag value, which accounts for the 'metatag_token_sanitize' setting.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Koen.Pasman created an issue. See original summary.

Koen.Pasman’s picture

Patch attached.

Koen.Pasman’s picture

Status: Active » Needs review
Koen.Pasman’s picture

FileSize
1.05 KB

Minor edit, replacing short array notation.

SocialNicheGuru’s picture

Status: Needs review » Needs work

This patch caused major errors.

Every module with a token gave a similar error
Notice: Trying to get property of non-object in token_tokens() (line 385 of modules/all/token/token.tokens.inc).
Notice: Trying to get property of non-object in token_tokens() (line 385 of modules/all/token/token.tokens.inc).

marco-s’s picture

Why don't you just use the PHP strip_tags function?

johnennew’s picture

Status: Needs work » Reviewed & tested by the community

Patch in #6 fixed the issue for me. Thanks.

  • Kingdutch committed 37dbb06 on 7.x-1.x authored by marco-s
    Issue #2876004 by Koen.Pasman, marco-s: Description metatags using...
Kingdutch’s picture

Assigned: Koen.Pasman » Unassigned
Status: Reviewed & tested by the community » Fixed

Committed! Thanks everyone for helping out! :)

Status: Fixed » Closed (fixed)

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