Delete folders
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3541364. --> Reported by: [f.mazeikis](https://www.drupal.org/user/3513671) Related to !516 >>> <h3 id="overview">Overview</h3> <p>This is follow-up to <a href="https://www.drupal.org/project/experience_builder/issues/3539729">#3539729</a>.</p> <ol> <li><del>When new SDC or block based Component entity is created, we should check if a Folder matching&nbsp;group&nbsp;property of such SDC exists. If it does, place Component in that Folder. If such a Folder doesn't exist, create it.</del><br> &rarr; <em>partially</em> handled in <span class="drupalorg-gitlab-issue-link project-issue-status-info project-issue-status-7"><a href="https://www.drupal.org/project/canvas/issues/3541364" title="Status: Closed (fixed)">#3541364: Delete folders</a></span> &mdash; that handled auto-creation for <code>Component</code>s, not yet for <code>JavaScriptComponent</code>s.<br> &rarr; remainder handled in <span class="drupalorg-gitlab-issue-link project-issue-status-info project-issue-status-7"><a href="https://www.drupal.org/project/canvas/issues/3549726" title="Status: Closed (fixed)">#3549726: Remove `category` from `Component` config entities, add `ComponentSourceInterface::determineDefaultFolder()` instead</a></span> </li><li><del>&#127381; since #9: update <code>JsComponent::createConfigEntity()</code> to NOT set <code>category: @todo</code> for the <code>Component</code> for an exposed code component, because this causes a "@todo" Folder to be created.</del> &rarr; handled in <span class="drupalorg-gitlab-issue-link project-issue-status-info project-issue-status-7"><a href="https://www.drupal.org/project/canvas/issues/3549726" title="Status: Closed (fixed)">#3549726: Remove `category` from `Component` config entities, add `ComponentSourceInterface::determineDefaultFolder()` instead</a></span> </li><li>When User deletes a Folder, we should disable (status: false) all of Component entities it "contains", or reject deleting the folder if any of the components are currently in use. </li></ol> <p>We also need tests for all of the above.</p> <h3 id="acceptance-criteria">Acceptance Criteria</h3> <ol> <li>Prevent deletion of folders containing any components.</li> <li>Allow deletion of empty folders.</li> <li>When the Delete Folder option is disabled, display a tooltip on hover to inform the user that folders with components cannot be deleted.</li> <li>Disable the Delete Folder option when the folder contains any components.</li> </ol> > Related issue: [Issue #3539729](https://www.drupal.org/node/3539729) > Related issue: [Issue #3541364](https://www.drupal.org/node/3541364)
issue