Skip to content

Commit

Permalink
Disable mod source change on edit (#301)
Browse files Browse the repository at this point in the history
This will:
- Disable mod source select list on mod edit as it doesn't make sense to
change Steam Workshop mod to Directory mod and vice versa and it was
never fully supported when mod was assigned to groups or lists.
  • Loading branch information
jskowronski39 authored Oct 22, 2023
2 parents fd00872 + 045f1bb commit a7e772d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Form/Mod/ModFormType.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,14 @@ public function __construct(

public function buildForm(FormBuilderInterface $builder, array $options): void
{
/** @var ModFormDto $modFormDto */
$modFormDto = $options['data'];
$modExists = null !== $modFormDto->getId();

$builder
->add('source', ChoiceType::class, [
'label' => 'Mod source',
'disabled' => $modExists,
'choices' => [
'Steam Workshop' => ModSourceEnum::STEAM_WORKSHOP->value,
'Directory' => ModSourceEnum::DIRECTORY->value,
Expand Down

0 comments on commit a7e772d

Please sign in to comment.