Skip to content

Commit

Permalink
Improved support for Neo fields
Browse files Browse the repository at this point in the history
  • Loading branch information
mmikkel committed Aug 20, 2020
1 parent aad5a09 commit ea7f782
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p

### Improved
- Restored the ability to open up field and/or element source settings via the cogwheels in a new tab, by holding down the Cmd (Mac) or Ctrl (Windows) key
- Improved support for Neo fields

## 1.2.1 - 2020-08-13

Expand Down
16 changes: 14 additions & 2 deletions src/resources/cpfieldinspect.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,23 @@
var $btn = $(this);
$btn.attr('data-cpfieldlinks-inited', true);

var field = $btn.parents('.field').get().slice(-1).pop();
if (!field) {
var rootField = $btn.parents('.field').get().slice(-1).pop();
var parentField = $btn.closest('.field');
if (!rootField || !parentField) {
return;
}

var field;
var rootFieldType = $(rootField).data('type');

switch (rootFieldType) {
case 'benf\\neo\\Field':
field = parentField;
break;
default:
field = rootField;
}

var fieldId = _this.getFieldId(field);
if (!fieldId) {
return;
Expand Down

0 comments on commit ea7f782

Please sign in to comment.