Fixes #4274 -- Add podcast storage location select to station form.
This commit is contained in:
parent
462759b122
commit
db8bc3dbb1
|
@ -653,6 +653,15 @@ return [
|
|||
],
|
||||
],
|
||||
|
||||
'podcasts_storage_location_id' => [
|
||||
'select',
|
||||
[
|
||||
'label' => __('Podcasts Storage Location'),
|
||||
'choices' => [],
|
||||
'form_group_class' => 'col-md-6',
|
||||
],
|
||||
],
|
||||
|
||||
'is_enabled' => [
|
||||
'toggle',
|
||||
[
|
||||
|
|
|
@ -86,6 +86,7 @@ class StationForm extends EntityForm
|
|||
$recordArray = $this->normalizeRecord($record);
|
||||
$recordArray['media_storage_location_id'] = $recordArray['media_storage_location']['id'] ?? null;
|
||||
$recordArray['recordings_storage_location_id'] = $recordArray['recordings_storage_location']['id'] ?? null;
|
||||
$recordArray['podcasts_storage_location_id'] = $recordArray['podcasts_storage_location']['id'] ?? null;
|
||||
|
||||
$this->populate($recordArray);
|
||||
}
|
||||
|
@ -121,6 +122,19 @@ class StationForm extends EntityForm
|
|||
)
|
||||
);
|
||||
}
|
||||
|
||||
if ($this->hasField('podcasts_storage_location_id')) {
|
||||
$recordingsStorageField = $this->getField('podcasts_storage_location_id');
|
||||
$recordingsStorageField->setOption('description', $storageLocationsDesc);
|
||||
$recordingsStorageField->setOption(
|
||||
'choices',
|
||||
$this->storageLocationRepo->fetchSelectByType(
|
||||
Entity\StorageLocation::TYPE_STATION_PODCASTS,
|
||||
$create_mode,
|
||||
__('Create a new storage location based on the base directory.'),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if ('POST' === $request->getMethod() && $this->isValid($request->getParsedBody())) {
|
||||
|
@ -146,6 +160,14 @@ class StationForm extends EntityForm
|
|||
)
|
||||
);
|
||||
}
|
||||
if (!empty($data['podcasts_storage_location_id'])) {
|
||||
$record->setPodcastsStorageLocation(
|
||||
$this->storageLocationRepo->findByType(
|
||||
Entity\StorageLocation::TYPE_STATION_PODCASTS,
|
||||
$data['podcasts_storage_location_id']
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$errors = $this->validator->validate($record);
|
||||
|
|
Loading…
Reference in New Issue