Skip to content

Commit

Permalink
Fix compatibilty with Statamic 3.3.50
Browse files Browse the repository at this point in the history
  • Loading branch information
jacksleight committed Nov 7, 2022
1 parent 447d941 commit 6794cd1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Changelog

## 0.3.0 ()
## 0.3.1 (2022-11-07)

- [fix] Compatibilty with Statamic 3.3.50

## 0.3.0 (2022-06-15)

- [new] Add JIT safe scan CLI command
- [fix] Scanning linked fields and fieldsets
Expand Down
11 changes: 6 additions & 5 deletions src/Fieldtypes/MinisetClassesFieldtype.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace JackSleight\StatamicMiniset\Fieldtypes;

use Facades\Statamic\Fieldtypes\RowId;
use Statamic\Fields\Fields;
use Statamic\Fields\Fieldtype;
use Statamic\Support\Arr;
Expand Down Expand Up @@ -43,11 +44,9 @@ public function process($data)

private function processGroup($group)
{
$group = array_except($group, '_id');

$fields = $this->fields()->addValues($group)->process()->values()->all();

$group = array_merge($group, $fields);
$group = array_merge(['id' => Arr::pull($group, '_id')], $group, $fields);

return Arr::removeNullValues($group);
}
Expand All @@ -67,8 +66,10 @@ private function preProcessGroup($group, $index)
{
$fields = $this->fields()->addValues($group)->preProcess()->values()->all();

$id = Arr::pull($group, 'id') ?? RowId::generate();

return array_merge($group, $fields, [
'_id' => "group-$index",
'_id' => $id,
]);
}

Expand Down Expand Up @@ -170,7 +171,7 @@ public static function generateClasses(array $value)
$list = [];
foreach ($value as $group) {
$variant = $group['variant'] ?? null;
unset($group['variant']);
$group = Arr::except($group, ['variant', 'id']);
if ($variant && ! Str::contains($variant, '&')) {
$variant = "{$variant}:&";
}
Expand Down

0 comments on commit 6794cd1

Please sign in to comment.