Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
When we select `Clone entity browser blocks` option while cloning entity, all blocks get cloned. In some scenarios, we need to clone only specific blocks and reuse few of them.
Proposed resolution
We should show a checklist to select blocks. In form alter, we are providing one checkbox(Clone entity browser blocks). If the user selects this checkbox, we can show a list of blocks that can be cloned. By default, all will be selected. If the user wants, user can deselect any block that can be resued instead of cloning.
Comment | File | Size | Author |
---|---|---|---|
#2 | Clone-Content.png | 38.53 KB | maithili11 |
#2 | 3208538-allow_specific_blocks_to_clone_2.patch | 4.99 KB | maithili11 |
Comments
Comment #2
maithili11 CreditAttribution: maithili11 as a volunteer and at Axelerant commentedProviding a patch based on "Proposed resolution"
Comment #3
mohit_aghera CreditAttribution: mohit_aghera at QED42 commentedFunction name should be prefixed with module machine name
- We can update method name.
- Reduce nested conditions and optimize code.
We can leverage early return by checking
"if(!$entity instanceOf FieldableEntityInterface)" etc.
I think we can give remove additional method and directly use the condition where this method is called.