Skip to content

Commit 8ccf200

Browse files
authored
Merge pull request #23 from venveo/bugfix/broken-entry-field-layouts
Fix field layout determination for entries
2 parents 7179806 + f7b09b0 commit 8ccf200

File tree

3 files changed

+13
-10
lines changed

3 files changed

+13
-10
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Bulk Edit Changelog
22

3+
## 2.0.3 - 2020-02-24
4+
### Fixed
5+
- Bug where bulk editing a section with a field layout that had been deleted could yield no fields
6+
37
## 2.0.2.1 - 2020-02-20
48
### Fixed
59
- Error that can occur if trying to bulkedit fields on a soft-deleted layout

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"name": "venveo/craft-bulkedit",
3-
"description": "Bulk edit entries",
3+
"description": "Bulk edit Craft CMS element fields",
44
"type": "craft-plugin",
5-
"version": "2.0.2.1",
5+
"version": "2.0.3",
66
"keywords": [
77
"craft",
88
"cms",

src/elements/processors/EntryProcessor.php

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,16 @@ class EntryProcessor extends AbstractElementTypeProcessor
2121
*/
2222
public static function getLayoutsFromElementIds($elementIds): array
2323
{
24-
$layouts = FieldLayout::find()
25-
->select('fieldlayouts.*')
24+
$types = \craft\records\Entry::find()
25+
->select('entrytypes.fieldLayoutId')
2626
->distinct(true)
2727
->limit(null)
28-
->from('{{%fieldlayouts}} fieldlayouts')
29-
->leftJoin('{{%elements}} elements', '[[elements.fieldLayoutId]] = [[fieldlayouts.id]]')
30-
->where(['IN', '[[elements.id]]', $elementIds])
31-
->andWhere(['=','fieldlayouts.dateDeleted', null])
32-
->all();
28+
->from('{{%entries}} entries')
29+
->leftJoin('{{%entrytypes}} entrytypes', '[[entries.typeId]] = [[entrytypes.id]]')
30+
->where(['IN', '[[entries.id]]', $elementIds])
31+
->column();
3332

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

3736
/**

0 commit comments

Comments
 (0)