Skip to content

Commit

Permalink
Nested Neo block elements are now supported.
Browse files Browse the repository at this point in the history
  • Loading branch information
Roel van Hintum committed May 3, 2021
1 parent 24bb7ff commit b953fa1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).

## 1.1.0 - 2021-05-03
### Added
- Nested Neo block elements are now supported.

## 1.0.1 - 2021-03-02
### Changed
- Allow to preview images that don't have a public URL (for instance, images on an AWS S3 private Bucket). Thanks to @billmn
Expand Down
9 changes: 9 additions & 0 deletions src/fields/ImageHotspots.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,15 @@ private function determineFieldOwner(string $fieldHandle, ElementInterface $elem
return $element;
}

// Neo block elements can be nested under a parent without them being the owner.
if (class_exists('\benf\neo\elements\Block') && $element instanceof \benf\neo\elements\Block) {
$parent = $element->getParent();

if (isset($parent)) {
return $this->determineFieldOwner($fieldHandle, $parent);
}
}

return $this->hasOwner($element) ? $this->determineFieldOwner($fieldHandle, $element->getOwner()) : null;
}

Expand Down

1 comment on commit b953fa1

@roelvanhintum
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes #2

Please sign in to comment.