Skip to content

Commit

Permalink
Updated MetProduct style
Browse files Browse the repository at this point in the history
  • Loading branch information
eusonlito authored Sep 20, 2021
1 parent 270621f commit 5c1f5ac
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/Eusonlito/LaravelMeta/Tags/MetaProduct.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,30 @@ public static function tagDefault($key, $values)
if (!is_array($values)) {
return;
}

$html = '';

foreach($values as $key => $value) {
if (in_array($key, self::$available, true)) {
$html .= '<meta property="'.self::propertyTag($key).'" content="'.$value.'" />';
}
}

return $html;

}

public static function propertyTag ($key)
{
$tag = 'product:';

switch ($key) {
case 'amount':
case 'price':
$tag .= 'price:amount';
break;
break;
case 'currency':
$tag .= 'price:currency';
break;
break;
}

return $tag;
Expand Down

0 comments on commit 5c1f5ac

Please sign in to comment.