2024-05-06 16:00:47 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace Modules\Plugins\Manifest;
|
|
|
|
|
2024-06-08 20:37:11 +00:00
|
|
|
use Override;
|
|
|
|
|
2024-05-06 16:00:47 +00:00
|
|
|
/**
|
2024-05-12 18:38:33 +00:00
|
|
|
* @property Field[] $general
|
|
|
|
* @property Field[] $podcast
|
|
|
|
* @property Field[] $episode
|
2024-05-06 16:00:47 +00:00
|
|
|
*/
|
|
|
|
class Settings extends ManifestObject
|
|
|
|
{
|
2024-12-23 15:35:47 +00:00
|
|
|
public static array $validation_rules = [
|
2024-05-06 16:00:47 +00:00
|
|
|
'general' => 'permit_empty|is_list',
|
|
|
|
'podcast' => 'permit_empty|is_list',
|
|
|
|
'episode' => 'permit_empty|is_list',
|
|
|
|
];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var array<string,array{string}|string>
|
|
|
|
*/
|
2024-12-23 15:35:47 +00:00
|
|
|
protected array $casts = [
|
2024-05-12 18:38:33 +00:00
|
|
|
'general' => [Field::class],
|
|
|
|
'podcast' => [Field::class],
|
|
|
|
'episode' => [Field::class],
|
2024-05-06 16:00:47 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
/**
|
2024-05-12 18:38:33 +00:00
|
|
|
* @var Field[]
|
2024-05-06 16:00:47 +00:00
|
|
|
*/
|
|
|
|
protected array $general = [];
|
|
|
|
|
|
|
|
/**
|
2024-05-12 18:38:33 +00:00
|
|
|
* @var Field[]
|
2024-05-06 16:00:47 +00:00
|
|
|
*/
|
|
|
|
protected array $podcast = [];
|
|
|
|
|
|
|
|
/**
|
2024-05-12 18:38:33 +00:00
|
|
|
* @var Field[]
|
2024-05-06 16:00:47 +00:00
|
|
|
*/
|
|
|
|
protected array $episode = [];
|
2024-06-08 20:37:11 +00:00
|
|
|
|
|
|
|
#[Override]
|
|
|
|
public function loadData(array $data): void
|
|
|
|
{
|
|
|
|
$newData = [];
|
|
|
|
foreach ($data as $key => $fields) {
|
|
|
|
$newFields = [];
|
|
|
|
foreach ($fields as $fieldKey => $field) {
|
|
|
|
$field['key'] = $fieldKey;
|
|
|
|
$newFields[] = $field;
|
|
|
|
}
|
|
|
|
|
|
|
|
$newData[$key] = $newFields;
|
|
|
|
}
|
|
|
|
|
|
|
|
parent::loadData($newData);
|
|
|
|
}
|
2024-05-06 16:00:47 +00:00
|
|
|
}
|