- Issue created by @jannakha
- 🇮🇳India abhishek@kumar
1.Configuration Setting
Add a new checkbox in the module's configuration form:$form['top_level_only'] = [ '#type' => 'checkbox', '#title' => $this->t('Show quick actions for top-level paragraphs only'), '#default_value' => $settings['top_level_only'] ?? FALSE, '#description' => $this->t('When enabled, quick actions will only appear for paragraphs that are not nested within other paragraphs.'), ];
2.Paragraph Detection Logic
Modify the action rendering logic to check paragraph hierarchy:function paragraphs_edit_should_show_actions(ParagraphInterface $paragraph) { $config = \Drupal::config('paragraphs_edit.settings'); if ($config->get('top_level_only')) { $parent = $paragraph->getParentEntity(); return !($parent instanceof ParagraphInterface); } return TRUE; }
3.JavaScript Modifications
Update the frontend logic to respect this setting:Drupal.behaviors.paragraphsEdit = { attach: function (context, settings) { if (settings.paragraphsEdit.topLevelOnly) { // Only attach handlers to top-level paragraphs $(context).find('.paragraph--type:not(.paragraph--type--nested)').once('paragraphs-edit').each(function() { // Attach quick actions }); } else { // Existing behavior } } };
New configuration option in /admin/config/content/paragraphs_edit
- 🇦🇺Australia jannakha Brisbane!
abhishek@kumar #2 looks good
please provide a merge request for testing