Commit 59a1d8b8 authored by José Fernandes's avatar José Fernandes Committed by Damien McKenna
Browse files

Issue #3223289 by DamienMcKenna, introfini: Added product:retailer_item_id.

parent ad29083d
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -51,6 +51,7 @@ Metatag 8.x-1.x-dev, xxxx-xx-xx
  9.3.x.
#3253736 by Dave Reid, zebda, DamienMcKenna: favicon meta tag was renamed in
  Drupal 9.3.0.
#3223289 by DamienMcKenna, introfini: Added product:retailer_item_id.


Metatag 8.x-1.16, 2021-03-15
+3 −0
Original line number Diff line number Diff line
@@ -4,3 +4,6 @@ metatag.metatag_tag.product_price_amount:
metatag.metatag_tag.product_price_currency:
  type: label
  label: 'Open Graph Product: Price currency'
metatag.metatag_tag.product_retailer_item_id:
  type: label
  label: 'Open Graph Product: Retailer Item ID'
+25 −0
Original line number Diff line number Diff line
<?php

namespace Drupal\metatag_open_graph_products\Plugin\metatag\Tag;

use Drupal\metatag\Plugin\metatag\Tag\MetaPropertyBase;

/**
 * Provides a plugin for the 'product:retailer_item_id' meta tag.
 *
 * @MetatagTag(
 *   id = "product_retailer_item_id",
 *   label = @Translation("Retailer Item ID"),
 *   description = @Translation("The ID of the product as provided by the retailer."),
 *   name = "product:retailer_item_id",
 *   group = "open_graph_products",
 *   weight = 1,
 *   type = "string",
 *   secure = FALSE,
 *   multiple = FALSE
 * )
 */
class ProductRetailerItemId extends MetaPropertyBase {
  // Nothing here yet. Just a placeholder class for a plugin.
}
+6 −2
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ class MetatagOpenGraphProductsTagsTest extends MetatagTagsTestBase {
  protected $tags = [
    'product_price_amount',
    'product_price_currency',
    'product_retailer_item_id',
  ];

  /**
@@ -38,8 +39,11 @@ class MetatagOpenGraphProductsTagsTest extends MetatagTagsTestBase {
   * Each of these meta tags has a different tag name vs its internal name.
   */
  protected function getTestTagName($tag_name) {
    // Replace the underlines with a colon.
    $tag_name = str_replace('_', ':', $tag_name);
    // Replace the first underline with a colon.
    $tag_name = str_replace('product_', 'product:', $tag_name);

    // Additional meta tags.
    $tag_name = str_replace('price_', 'price:', $tag_name);

    return $tag_name;
  }
+3 −1
Original line number Diff line number Diff line
@@ -349,9 +349,11 @@ class MetatagEntities extends ProcessPluginBase {
      'video:writer' => 'video_writer',

      // From metatag_opengraph_products.metatag.inc:
      // https://www.drupal.org/project/metatag/issues/2835925
      'product:price:amount' => 'product_price_amount',
      'product:price:currency' => 'product_price_currency',
      // Not supported in D7.
      // @todo '' => 'product_retailer_item_id,
      // Not yet supported in D9.
      // @todo 'product:availability' => '',
      // @todo 'product:brand' => '',
      // @todo 'product:upc' => '',
Loading