- Notifications
You must be signed in to change notification settings - Fork 9.4k
add isMultipleFiles property to image form element template #36325
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add isMultipleFiles property to image form element template #36325
Conversation
Hi @webPacco. Thank you for your contribution
❗ Automated tests can be triggered manually with an appropriate comment:
You can find more information about the builds here ℹ️ Run only required test builds during development. Run all test builds before sending your pull request for review. For more details, review the Magento Contributor Guide documentation. 🕙 You can find the schedule on the Magento Community Calendar page. 📞 The triage of Pull Requests happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket. ✏️ Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel |
…e_file_image_form
@magento run all tests |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time. |
@magento run all tests |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time. |
@magento run Integration Tests, Functional Tests EE, Functional Tests CE, Functional Tests B2B |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time. |
@magento run Integration Tests, Functional Tests EE, Functional Tests CE, Functional Tests B2B |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time. |
Hi @pacco-a The issue is not reproducible on 2.4-develop branch.
Please let us know if we are missing something here. |
Hi @pacco-a We have noticed that this PR has not been updated for a period of 14 Days. Thanks |
Hi @engcom-Echo, Sorry for the time. I personally keep reproducing this behavior when using 2.4-develop branch. Maybe there is something wrong in my process : 1 - Configuring a blank new 2.4-develop project. 2 - Creating a new module for testing purposes (here : "FormTestModule") 3 - Adding a Controller (1) , layout (2) , Ui Component form (3) , dummy DataProvider (4), dummy Uploader route (5) (1)<?php declare(strict_types=1); namespace Pacco\FormTestModule\Controller\Adminhtml\FormTestController; use Magento\Backend\App\Action; use Magento\Backend\App\Action\Context; use Magento\Framework\App\Action\HttpGetActionInterface; use Magento\Framework\Controller\ResultInterface; use Magento\Framework\View\Result\PageFactory; class FormTestAction extends Action implements HttpGetActionInterface { private PageFactory $resultPageFactory; public function __construct( Context $context, PageFactory $resultPageFactory ) { parent::__construct($context); $this->resultPageFactory = $resultPageFactory; } public function execute(): ResultInterface { $page = $this->resultPageFactory->create(); $page->getConfig()->getTitle()->set('Test form title'); return $page; } } (2)<?xml version="1.0"?> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="admin-2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <body> <referenceContainer name="content"> <uiComponent name="formtest_formtest_formtest_form"/> </referenceContainer> </body> </page> (3)<?xml version="1.0"?> <form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd"> <argument name="data" xsi:type="array"> <item name="js_config" xsi:type="array"> <item name="provider" xsi:type="string"> formtest_formtest_formtest_form.formtest_formtest_formtest_form_data_source </item> <item name="deps" xsi:type="string"> formtest_formtest_formtest_form.formtest_formtest_formtest_form_data_source </item> </item> <item name="config" xsi:type="array"> <item name="dataScope" xsi:type="string">data</item> </item> <item name="template" xsi:type="string">templates/form/collapsible</item> <item name="label" xsi:type="string" translate="true">FormTest Form</item> <item name="buttons" xsi:type="array"> </item> </argument> <dataSource name="formtest_formtest_formtest_form_data_source"> <argument name="dataProvider" xsi:type="configurableObject"> <argument name="class" xsi:type="string"> Pacco\FormTestModule\Ui\Component\Form\FormTestDataProvider </argument> <argument name="name" xsi:type="string">formtest_formtest_formtest_form_data_source</argument> <argument name="primaryFieldName" xsi:type="string">id</argument> <argument name="requestFieldName" xsi:type="string">id</argument> </argument> <argument name="data" xsi:type="array"> <item name="js_config" xsi:type="array"> <item name="component" xsi:type="string">Magento_Ui/js/form/provider</item> </item> </argument> </dataSource> <fieldset name="config"> <argument name="data" xsi:type="array"> <item name="config" xsi:type="array"> <item name="label" xsi:type="string" translate="true">Configuration</item> <item name="collapsible" xsi:type="boolean">false</item> <item name="visible" xsi:type="boolean">false</item> </item> </argument> <field name="edit_type"> <argument name="data" xsi:type="array"> <item name="config" xsi:type="array"> <item name="dataType" xsi:type="string">text</item> <item name="formElement" xsi:type="string">input</item> <item name="default" xsi:type="string">default</item> </item> </argument> </field> </fieldset> <fieldset name="formtest"> <argument name="data" xsi:type="array"> <item name="config" xsi:type="array"> <item name="label" xsi:type="string" translate="true">FormTest</item> <item name="collapsible" xsi:type="boolean">false</item> <item name="dataScope" xsi:type="string">formtest</item> </item> </argument> <field name="name"> <argument name="data" xsi:type="array"> <item name="config" xsi:type="array"> <item name="label" xsi:type="string" translate="true">Workshop name</item> <item name="dataType" xsi:type="string">text</item> <item name="formElement" xsi:type="string">input</item> </item> </argument> </field> </fieldset> <fieldset name="image"> <argument name="data" xsi:type="array"> <item name="config" xsi:type="array"> <item name="label" xsi:type="string" translate="true">Media</item> </item> </argument> <field name="image"> <argument name="data" xsi:type="array"> <item name="config" xsi:type="array"> <item name="dataType" xsi:type="string">string</item> <item name="source" xsi:type="string">image</item> <item name="label" xsi:type="string" translate="true">Image</item> <item name="visible" xsi:type="boolean">true</item> <item name="allowedExtensions" xsi:type="string">jpg jpeg gif png webp</item> <item name="isMultipleFiles" xsi:type="boolean">true</item> <item name="formElement" xsi:type="string">imageUploader</item> <item name="elementTmpl" xsi:type="string">ui/form/element/uploader/uploader</item> <item name="previewTmpl" xsi:type="string">Magento_Catalog/image-preview</item> <item name="validation" xsi:type="array"> <item name="required-entry" xsi:type="boolean">true</item> </item> <item name="uploaderConfig" xsi:type="array"> <item name="url" xsi:type="url" path="formtest/upload/uploader"/> </item> </item> </argument> </field> </fieldset> </form> (4)<?php namespace Pacco\FormTestModule\Ui\Component\Form; use Magento\Framework\View\Element\UiComponent\DataProvider\DataProvider; class FormTestDataProvider extends DataProvider { public function getData(): array { return []; } } (5)<?php declare(strict_types=1); namespace Pacco\FormTestModule\Controller\Adminhtml\Upload; use Magento\Backend\App\Action; use Magento\Framework\App\Action\HttpPostActionInterface; use Magento\Framework\Controller\Result\Json; use Magento\Framework\Controller\ResultFactory; use Magento\Framework\Controller\ResultInterface; class Uploader extends Action implements HttpPostActionInterface { public function __construct( Action\Context $context ) { parent::__construct($context); } public function execute(): ResultInterface { /** @var Json $jsonResult */ $jsonResult = $this->resultFactory->create(ResultFactory::TYPE_JSON); return $jsonResult->setData([ 'name' => 'filename', 'size' => 1234, 'type' => 'image', 'path' => 'mypathpath', 'url' => 'pathpathpathurl' ]); } } Thanks |
Hi @engcom-Lima, can you please reopen this issue? Thanks you |
Poke @engcom-Echo, can you help me please? |
Hi @pacco-a. Thank you for your contribution! Add the comment under your pull request to deploy test or vanilla Magento instance:
❗ Automated tests can be triggered manually with an appropriate comment:
Allowed build names are:
You can find more information about the builds here For more details, review the Code Contributions documentation. |
…e_file_image_form
@magento create issue |
Hello @pacco-a, Thanks for the collaboration & contribution! ✔️ QA PassedSteps to reproduce: Pardon the broken image here, file upload is not handled as the main issue is reproduced. Before: ✖️div block Browse to find or drag image disappears after uploading a file. After: ✔️div block Browse to find or drag image does not disappear after uploading a file. Thank you. |
…e_file_image_form
@magento run all tests |
@magento run Integration Tests |
@magento run Unit Tests, WebAPI Tests |
All the builds are green, moving this to Merge in progress. |
f645b64
into magento:2.4-develop
Prevent the "Browse to find or drag image here" button to disappear when an image is added in a multiple files image form element.
Description (*)
The only modification in the code is the addition of the already existing (and utilized) property "isMultipleFiles" into the condition that determine whether the "Browse to find or drag image here" button should be display or not.
In doing so, when the user add an image to the multiple files image form element, the "Browse to find or drag image here" is still there.
This is useful to inform the user that the form element can take multiple images and that these images can be drag and drop, especially when the form element is initially populated with existing images.
Manual testing scenarios (*)
Contribution checklist (*)
Resolved issues: