Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
mullema committed Feb 22, 2021
2 parents 14f93cc + b751782 commit 673b2f7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
23 changes: 11 additions & 12 deletions fields/image-clip.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,19 +139,18 @@
$uri = null;
}

switch ($uri) {
case '/':
// if no uri, find out whether the file is from Site or Home Page
if (!$uri) {
if ($this->data()['field']->model() instanceof Kirby\Cms\Site) {
$parent = site();
break;
case null:
$parent = page();
break;
default:
$site = site();
if (!$parent = $site->page($uri)) {
$parent = $site->draft($uri);
}
break;
} else {
$parent = page(); // home
}
} else {
$site = site();
if (!$parent = $site->page($uri)) {
$parent = $site->draft($uri);
}
}

if ($parent) {
Expand Down
Loading

0 comments on commit 673b2f7

Please sign in to comment.