- Issue created by @Anybody
- 🇩🇪Germany Anybody Porta Westfalica
Of course, the functionality / UX could also be helpful for the other field tools, like form displays etc.!
- First commit to issue fork.
- Status changed to Needs review
6 months ago 2:09pm 11 July 2024 - Merge request !11Issue #3415791: Allow "Clone display" to current bundle view mode (overwrite) → (Open) created by niber
- Status changed to Needs work
6 months ago 9:00am 18 July 2024 - 🇫🇷France Grimreaper France 🇫🇷
Hi,
Thanks for the MR.
I put a review comment. And here are my global feedbacks.
The "overwrite" feature asked in the original issue and I also think this will be useful, is not implemented.
I think the form needs to be simplified, having all those behaviors with #states is confusing and error prone.I have:
- created the toto and tata view modes on content type.
- enabled the tata entity view display on basic page
- wanted to clone tata into toto for basic page
- obtained the following fatal errorThe website encountered an unexpected error. Try again later. Drupal\Core\Entity\EntityStorageException: 'entity_view_display' entity with ID 'node.page.tata' already exists. in Drupal\Core\Entity\EntityStorageBase->doPreSave() (line 519 of core/lib/Drupal/Core/Entity/EntityStorageBase.php). Drupal\Core\Entity\EntityStorageBase->save(Object) (Line: 257) Drupal\Core\Config\Entity\ConfigEntityStorage->save(Object) (Line: 354) Drupal\Core\Entity\EntityBase->save() (Line: 613) Drupal\Core\Config\Entity\ConfigEntityBase->save() (Line: 166) Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplay->save() (Line: 146) Drupal\field_tools\DisplayCloner->cloneDisplay(Object, 'page', 'toto') (Line: 225) Drupal\field_tools\Form\EntityDisplayBulkCloneForm->submitForm(Array, Object) call_user_func_array(Array, Array) (Line: 129) Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 67) Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 597) Drupal\Core\Form\FormBuilder->processForm('field_tools_displays_clone_form', Array, Object) (Line: 326) Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 73) Drupal\Core\Controller\FormController->getContentResult(Object, Object) call_user_func_array(Array, Array) (Line: 123) Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 638) Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 121) Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97) Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 181) Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76) Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 53) Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48) Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 28) Drupal\Core\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 32) Drupal\big_pipe\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 106) Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85) Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 48) Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51) Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 36) Drupal\Core\StackMiddleware\AjaxPageState->handle(Object, 1, 1) (Line: 51) Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 741) Drupal\Core\DrupalKernel->handle(Object) (Line: 19) require('/project/app/index.php') (Line: 4)
So I guess in some loops tata is taken to be cloned too.
Attaching screenshots of the steps to reproduce the error.
- Assigned to niber
- Status changed to Active
6 months ago 7:11am 19 July 2024 - Status changed to Needs work
6 months ago 7:14am 19 July 2024 - 🇫🇷France Grimreaper France 🇫🇷
Hi,
As there is already work done on the issue, the status should remain "Needs work", https://www.drupal.org/docs/develop/issues/fields-and-other-parts-of-an-... → .
- Issue was unassigned.
- Status changed to Needs review
6 months ago 2:55pm 22 July 2024 - Status changed to Needs work
6 months ago 12:05pm 23 July 2024 - 🇫🇷France Grimreaper France 🇫🇷
Nice!
The form is way more simple to handle and nice to have added validation.
The overwrite of an existing display is almost ok. As you can see on the video recording, the "links" configuration are not properly reset when overwritting, but ok when cloning for the first time.
- Status changed to Needs review
5 months ago 8:51am 22 August 2024 Thanks for your code review !
I just fixed the phpcs warning and errors on DisplayCloner and EntityDisplayBulkCloneForm php files.- Assigned to niber
- Status changed to Needs work
5 months ago 3:27pm 23 August 2024 - Issue was unassigned.
- Status changed to Needs review
5 months ago 8:58am 26 August 2024 Added a new separated form for cloning to a display for the current bundle. Made this for more readability/intuitive usage.
- First commit to issue fork.
- 🇫🇷France maboy
Hello,
All these cases have been tested and worked on my side with MR 11 :
- Clone a view mode without layout builder in another bundle (destination view mode not existing)
- Clone a view mode without layout builder in another bundle (destination view mode existing and layout builder mode is disabled)
- Clone a view mode without layout builder in another bundle (destination view mode existing and layout builder mode is enabled)
- Clone a view mode without layout builder in the same bundle (destination view mode existing and layout builder mode is disabled)
- Clone a view mode without layout builder in the same bundle (destination view mode existing and layout builder mode is enabled)
Regards,
- 🇫🇷France Grimreaper France 🇫🇷
Hello,
I have rebased the MR and generate a patch file for Composer from latest version.
- Merge request !19Resolve #3415791 "Clone display layout builder support" → (Open) created by Grimreaper
- 🇫🇷France Grimreaper France 🇫🇷
Here is a patch from the new MR which cumulates changes from this issue and ✨ Support Layout Builder Active .
- 🇫🇷France Grimreaper France 🇫🇷
I have tested some cases from comment 16 and comment #3255606-9: Support Layout Builder → .
Works perfectly.
Thanks!