diff --git a/modules/paragraphs_library/paragraphs_library.module b/modules/paragraphs_library/paragraphs_library.module index f8988b1..34766b2 100644 --- a/modules/paragraphs_library/paragraphs_library.module +++ b/modules/paragraphs_library/paragraphs_library.module @@ -148,12 +148,14 @@ function paragraphs_library_form_paragraphs_type_form_alter(&$form, FormStateInt // Adds paragraph type grouping to the form. /** @var \Drupal\paragraphs\ParagraphsTypeInterface $paragraph_type */ $paragraph_type = $form_state->getFormObject()->getEntity(); - $form['allow_library_conversion'] = [ - '#type' => 'checkbox', - '#title' => t('Allow adding to library'), - '#default_value' => $paragraph_type->getThirdPartySetting('paragraphs_library', 'allow_library_conversion', FALSE), - ]; - $form['#entity_builders'][] = 'paragraphs_library_form_paragraphs_type_form_builder'; + if ($paragraph_type->id() != 'from_library') { + $form['allow_library_conversion'] = [ + '#type' => 'checkbox', + '#title' => t('Allow adding to library'), + '#default_value' => $paragraph_type->getThirdPartySetting('paragraphs_library', 'allow_library_conversion', FALSE), + ]; + $form['#entity_builders'][] = 'paragraphs_library_form_paragraphs_type_form_builder'; + } } /** diff --git a/modules/paragraphs_library/src/Tests/ParagraphsLibraryItemTest.php b/modules/paragraphs_library/src/Tests/ParagraphsLibraryItemTest.php index 0904757..bffcc8e 100644 --- a/modules/paragraphs_library/src/Tests/ParagraphsLibraryItemTest.php +++ b/modules/paragraphs_library/src/Tests/ParagraphsLibraryItemTest.php @@ -218,6 +218,10 @@ class ParagraphsLibraryItemTest extends ParagraphsExperimentalTestBase { $this->drupalGet('node/add/paragraphed_test'); $this->drupalPostForm(NULL, NULL, 'Add Text'); $this->assertNoRaw('Add to library'); + + // Test that the checkbox is not visible on from_library. + $this->drupalGet('admin/structure/paragraphs_type/from_library'); + $this->assertNoField('allow_library_conversion'); } /**