Skip to content

Commit

Permalink
Fix field layout determination for entries
Browse files Browse the repository at this point in the history
  • Loading branch information
Mosnar committed Feb 24, 2020
1 parent a9013a6 commit f7b09b0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Bulk Edit Changelog

## 2.0.3 - 2020-02-24
### Fixed
- Bug where bulk editing a section with a field layout that had been deleted could yield no fields

## 2.0.2.1 - 2020-02-20
### Fixed
- Error that can occur if trying to bulkedit fields on a soft-deleted layout
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "venveo/craft-bulkedit",
"description": "Bulk edit entries",
"description": "Bulk edit Craft CMS element fields",
"type": "craft-plugin",
"version": "2.0.2.1",
"version": "2.0.3",
"keywords": [
"craft",
"cms",
Expand Down
15 changes: 7 additions & 8 deletions src/elements/processors/EntryProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,16 @@ class EntryProcessor extends AbstractElementTypeProcessor
*/
public static function getLayoutsFromElementIds($elementIds): array
{
$layouts = FieldLayout::find()
->select('fieldlayouts.*')
$types = \craft\records\Entry::find()
->select('entrytypes.fieldLayoutId')
->distinct(true)
->limit(null)
->from('{{%fieldlayouts}} fieldlayouts')
->leftJoin('{{%elements}} elements', '[[elements.fieldLayoutId]] = [[fieldlayouts.id]]')
->where(['IN', '[[elements.id]]', $elementIds])
->andWhere(['=','fieldlayouts.dateDeleted', null])
->all();
->from('{{%entries}} entries')
->leftJoin('{{%entrytypes}} entrytypes', '[[entries.typeId]] = [[entrytypes.id]]')
->where(['IN', '[[entries.id]]', $elementIds])
->column();

return $layouts;
return FieldLayout::find()->where(['IN', '[[id]]', $types])->all();
}

/**
Expand Down

0 comments on commit f7b09b0

Please sign in to comment.