Skip to content

Commit

Permalink
Update Vote.php
Browse files Browse the repository at this point in the history
  • Loading branch information
conseilgouz committed Mar 3, 2024
1 parent 5f84ef9 commit 881b8db
Showing 1 changed file with 16 additions and 17 deletions.
33 changes: 16 additions & 17 deletions plugins/content/vote/src/Extension/Vote.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,27 +140,26 @@ private function displayVotingData($context, &$row, &$params, $page)
public function onSchemaBeforeCompileHead($schema, $context): void
{
$graph = $schema->get('@graph');

$need_vote = PluginHelper::isEnabled('content', 'vote');

if (!$need_vote) {
return;
}
if (!$need_vote) {
return;
}
foreach ($graph as $key => &$entry) {
if (!isset($entry['@type'])) {
continue;
}
if ($entry['@type'] == 'Recipe') {
$rating = $this->prepareRecipeAggregateRating($ontext);
continue;
}
$rating = $this->prepareProductAggregateRating($context);
}

if ($rating) {
$graph[] = $rating;
$schema->set('@graph', $graph);
}
if ($entry['@type'] == 'Recipe') {
$rating = $this->prepareRecipeAggregateRating($ontext);
continue;
}
$rating = $this->prepareProductAggregateRating($context);
}

if ($rating) {
$graph[] = $rating;
$schema->set('@graph', $graph);
}
}

}
}

0 comments on commit 881b8db

Please sign in to comment.