Skip to content

Commit

Permalink
Add some comments
Browse files Browse the repository at this point in the history
  • Loading branch information
kayue authored Dec 11, 2017
1 parent 6a9cda8 commit f14f2ed
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions Wordpress/Helper/AttachmentHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ protected function getManager()

public function findThumbnail(Post $post)
{
// Switch to correct blog
$originBlogId = $this->getManager()->getBlogId();
if ($this->getManager()->getBlogId() !== $post->getBlogId()) {
if ($originBlogId !== $post->getBlogId()) {
$this->managerRegistry->setCurrentBlogId($post->getBlogId());
}

Expand All @@ -43,17 +44,17 @@ public function findThumbnail(Post $post)
'type' => 'attachment',
]);

if ($originBlogId !== $this->getManager()->getBlogId()) {
$this->managerRegistry->setCurrentBlogId($originBlogId);
}
// Reset blog ID
$this->managerRegistry->setCurrentBlogId($originBlogId);

return $thumbnail;
}

public function getAttachmentUrl(Post $post, $size = 'post-thumbnail')
{
// Switch to correct blog
$originBlogId = $this->getManager()->getBlogId();
if ($this->getManager()->getBlogId() !== $post->getBlogId()) {
if ($originBlogId !== $post->getBlogId()) {
$this->managerRegistry->setCurrentBlogId($post->getBlogId());
}

Expand All @@ -62,9 +63,8 @@ public function getAttachmentUrl(Post $post, $size = 'post-thumbnail')
'key' => '_wp_attachment_metadata',
]);

if ($originBlogId !== $this->getManager()->getBlogId()) {
$this->managerRegistry->setCurrentBlogId($originBlogId);
}
// Reset blog ID
$this->managerRegistry->setCurrentBlogId($originBlogId);

if (!$metadata) {
return null;
Expand Down

0 comments on commit f14f2ed

Please sign in to comment.