Skip to content

Commit

Permalink
added checks
Browse files Browse the repository at this point in the history
fixes #11, #12
  • Loading branch information
RobinSecondred committed Apr 2, 2020
1 parent c18b8a3 commit 1f280e8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
### fixed

- do not relabel fields in matrix blocks [#14](https://github.com/Anubarak/craft-relabel/issues/14)
- fixed a bug that could cause the project-config syncing to fail [12](https://github.com/Anubarak/craft-relabel/issues/12) & [11](https://github.com/Anubarak/craft-relabel/issues/11)
- security fix by bencroker, thanks for this and sorry for being so late [13](https://github.com/Anubarak/craft-relabel/pull/13)

## 1.3.4 - 2019-09-30

Expand Down
14 changes: 12 additions & 2 deletions src/services/RelabelService.php
Original file line number Diff line number Diff line change
Expand Up @@ -707,9 +707,19 @@ public function handleChangedRelabel(ConfigEvent $event): bool
$record = new RelabelRecord();
}


$fieldId = Db::idByUid('{{%fields}}', $event->newValue['field']);
if($fieldId === null){
return false;
}
$fieldLayoutId = Db::idByUid('{{%fieldlayouts}}', $event->newValue['fieldLayout']);
if($fieldLayoutId === null){
return false;
}

$record->uid = $uid;
$record->fieldId = Db::idByUid('{{%fields}}', $event->newValue['field']);
$record->fieldLayoutId = Db::idByUid('{{%fieldlayouts}}', $event->newValue['fieldLayout']);
$record->fieldId = $fieldId;
$record->fieldLayoutId = $fieldLayoutId;
$record->instructions = $event->newValue['instructions'];
$record->name = $event->newValue['name'];

Expand Down

0 comments on commit 1f280e8

Please sign in to comment.