Skip to content

Commit

Permalink
Add validation for the field-name option
Browse files Browse the repository at this point in the history
  • Loading branch information
DieterHolvoet committed Dec 15, 2021
1 parent 2e43e51 commit 12e7564
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Drupal/Commands/core/FieldDeleteCommands.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@ public function delete(string $entityType, ?string $bundle = null, array $option
$fieldName = $this->input->getOption('field-name') ?? $this->askExisting($entityType, $bundle);
$this->input->setOption('field-name', $fieldName);

if ($fieldName === '') {
throw new \InvalidArgumentException(dt('The %optionName option is required.', [
'%optionName' => 'field-name',
]));
}

/** @var FieldConfig[] $results */
$results = $this->entityTypeManager
->getStorage('field_config')
Expand Down

0 comments on commit 12e7564

Please sign in to comment.