Skip to content

Commit

Permalink
Issue #96: Allow setting the download_uri manually
Browse files Browse the repository at this point in the history
  • Loading branch information
J-Ben87 committed Oct 27, 2023
1 parent c45ddb5 commit 3696c6b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ Available options for the `ImageType`:
- `cancel_button_class` (`string`): class of the button (default: `''`)
- `save_button_class` (`string`): class of the button (default: `''`)
- `download_uri` (`string`): the path where the image is located (default: `null`, automatically set)
- `download_link` (`bool`): whether the end user should be able to add a remote image by URL or not (default: `true`)
- `download_link` (`bool`): whether the image should be rendered in the form or not (default: `true`)
- `file_upload_enabled` (`bool`): whether to enable the file upload widget or not (default: `true`)
- `remote_url_enabled` (`bool`): whether to enable the remote url widget or not (default: `true`)
- `rotation_enabled` (`bool`): whether to enable the rotation or not (default: `false`)
Expand Down
4 changes: 2 additions & 2 deletions src/Form/Type/ImageType.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ public function buildView(FormView $view, FormInterface $form, array $options):
$view->vars['upload_mimetype'] = $options['upload_mimetype'];
$view->vars['upload_quality'] = $options['upload_quality'];

if ($options['download_link'] && $downloadUri = $this->generateDownloadUri($form)) {
$view->vars['download_uri'] = $downloadUri;
if ($options['download_link']) {
$view->vars['download_uri'] = $options['download_uri'] ?? $this->generateDownloadUri($form);
}
}

Expand Down

0 comments on commit 3696c6b

Please sign in to comment.