Skip to content

Commit

Permalink
[Shortcut] fixes serialization
Browse files Browse the repository at this point in the history
  • Loading branch information
Elorfin committed Jan 15, 2021
1 parent d18f525 commit 0d6b9ba
Showing 1 changed file with 0 additions and 12 deletions.
12 changes: 0 additions & 12 deletions src/main/core/API/Serializer/Resource/ResourceNodeSerializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
use Claroline\CoreBundle\Manager\Resource\MaskManager;
use Claroline\CoreBundle\Manager\Resource\OptimizedRightsManager;
use Claroline\CoreBundle\Manager\Resource\RightsManager;
use Claroline\LinkBundle\Entity\Resource\Shortcut;

class ResourceNodeSerializer
{
Expand Down Expand Up @@ -207,17 +206,6 @@ private function serializeMeta(ResourceNode $resourceNode, array $options): arra
'commentsActivated' => $resourceNode->isCommentsActivated(),
];

if (Shortcut::class === $resourceNode->getResourceType()->getClass()) {
// required for opening the proper player in case of shortcut. This is not pretty but the players
// need the meta['type'] to be the target one to open the proper player/editor (they don't know what to do otherwise)
// unless we implement a "link" player which will then the target and dispatch again.
// This is the easy way
/** @var Shortcut $resource */
$resource = $this->om->getRepository($resourceNode->getClass())->findOneBy(['resourceNode' => $resourceNode]);
$target = $resource->getTarget();
$meta['type'] = $target->getResourceType()->getName();
}

if (!in_array(Options::SERIALIZE_MINIMAL, $options)) {
$meta = array_merge($meta, [
'authors' => $resourceNode->getAuthor(),
Expand Down

0 comments on commit 0d6b9ba

Please # to comment.