diff --git a/config/schema/paragraphs_type.schema.yml b/config/schema/paragraphs_type.schema.yml index d763884..57de57c 100644 --- a/config/schema/paragraphs_type.schema.yml +++ b/config/schema/paragraphs_type.schema.yml @@ -37,7 +37,7 @@ paragraphs.behavior.settings.*: entity_reference_selection.default:paragraph: type: entity_reference_selection mapping: - negotate: + negate: type: boolean target_bundles_drag_drop: type: sequence diff --git a/src/Plugin/EntityReferenceSelection/ParagraphSelection.php b/src/Plugin/EntityReferenceSelection/ParagraphSelection.php index a28ee6f..a2c9d22 100644 --- a/src/Plugin/EntityReferenceSelection/ParagraphSelection.php +++ b/src/Plugin/EntityReferenceSelection/ParagraphSelection.php @@ -31,7 +31,7 @@ class ParagraphSelection extends DefaultSelection { // Merge-in default values. $selection_handler_settings += array( 'target_bundles' => array(), - 'negotate' => FALSE, + 'negate' => FALSE, 'target_bundles_drag_drop' => array(), ); @@ -51,13 +51,13 @@ class ParagraphSelection extends DefaultSelection { $weight++; } - // Do negotate the selection. - $form['negotate'] = [ + // Do negate the selection. + $form['negate'] = [ '#type' => 'select', '#options' => [0 => 'Include', 1 => 'Exclude'], '#title' => $this->t('Choose paragraph types'), '#return_value' => 1, - '#default_value' => isset($selection_handler_settings['negotate']) ? $selection_handler_settings['negotate'] : FALSE, + '#default_value' => isset($selection_handler_settings['negate']) ? $selection_handler_settings['negate'] : FALSE, ]; // Kept for compatibility with other entity reference widgets. @@ -169,7 +169,7 @@ class ParagraphSelection extends DefaultSelection { * {@inheritdoc} */ protected function getAllowedTypes() { - if (!isset($this->configuration['handler_settings']['negotate']) || $this->configuration['handler_settings']['negotate'] != '1') { + if (!isset($this->configuration['handler_settings']['negate']) || $this->configuration['handler_settings']['negate'] != '1') { return $this->configuration['handler_settings']['target_bundles']; } $bundles = \Drupal::service('entity_type.bundle.info')->getBundleInfo($this->configuration['target_type']); diff --git a/src/Plugin/Field/FieldWidget/InlineParagraphsWidget.php b/src/Plugin/Field/FieldWidget/InlineParagraphsWidget.php index 77daa7d..ef1732a 100644 --- a/src/Plugin/Field/FieldWidget/InlineParagraphsWidget.php +++ b/src/Plugin/Field/FieldWidget/InlineParagraphsWidget.php @@ -707,7 +707,7 @@ class InlineParagraphsWidget extends WidgetBase { if ($this->getSelectionHandlerSetting('target_bundles') !== NULL) { $bundles = array_intersect_key($bundles, $this->getSelectionHandlerSetting('target_bundles')); - if ($this->getSelectionHandlerSetting('negotate')) { + if ($this->getSelectionHandlerSetting('negate')) { $bundles = \Drupal::service('entity_type.bundle.info')->getBundleInfo($target_type); $bundles = array_diff_key($bundles, $this->getSelectionHandlerSetting('target_bundles')); } diff --git a/src/Plugin/Field/FieldWidget/ParagraphsWidget.php b/src/Plugin/Field/FieldWidget/ParagraphsWidget.php index 166f386..6d68acc 100644 --- a/src/Plugin/Field/FieldWidget/ParagraphsWidget.php +++ b/src/Plugin/Field/FieldWidget/ParagraphsWidget.php @@ -684,7 +684,7 @@ class ParagraphsWidget extends WidgetBase { if ($this->getSelectionHandlerSetting('target_bundles') !== NULL) { $bundles = array_intersect_key($bundles, $this->getSelectionHandlerSetting('target_bundles')); - if ($this->getSelectionHandlerSetting('negotate')) { + if ($this->getSelectionHandlerSetting('negate')) { $bundles = \Drupal::service('entity_type.bundle.info')->getBundleInfo($target_type); $bundles = array_diff_key($bundles, $this->getSelectionHandlerSetting('target_bundles')); } diff --git a/src/Tests/Classic/ParagraphsConfigTest.php b/src/Tests/Classic/ParagraphsConfigTest.php index dfa586d..97e77fe 100644 --- a/src/Tests/Classic/ParagraphsConfigTest.php +++ b/src/Tests/Classic/ParagraphsConfigTest.php @@ -202,7 +202,7 @@ class ParagraphsConfigTest extends ParagraphsTestBase { $this->drupalGet('admin/structure/types/manage/paragraphed_test/fields/node.paragraphed_test.paragraphs'); $edit = [ - 'settings[handler_settings][negotate]' => 0, + 'settings[handler_settings][negate]' => 0, 'settings[handler_settings][target_bundles_drag_drop][paragraph_type_test][enabled]' => 1, ]; $this->drupalPostForm(NULL, $edit, 'Save settings'); @@ -225,7 +225,7 @@ class ParagraphsConfigTest extends ParagraphsTestBase { $this->drupalGet('admin/structure/types/manage/paragraphed_test/fields/node.paragraphed_test.paragraphs'); $edit = [ - 'settings[handler_settings][negotate]' => 1, + 'settings[handler_settings][negate]' => 1, 'settings[handler_settings][target_bundles_drag_drop][text][enabled]' => 1, ]; $this->drupalPostForm(NULL, $edit, 'Save settings'); diff --git a/src/Tests/Experimental/ParagraphsExperimentalConfigTest.php b/src/Tests/Experimental/ParagraphsExperimentalConfigTest.php index c0bf22e..3c457df 100644 --- a/src/Tests/Experimental/ParagraphsExperimentalConfigTest.php +++ b/src/Tests/Experimental/ParagraphsExperimentalConfigTest.php @@ -170,7 +170,7 @@ class ParagraphsExperimentalConfigTest extends ParagraphsExperimentalTestBase { $this->drupalGet('admin/structure/types/manage/paragraphed_test/fields/node.paragraphed_test.paragraphs'); $edit = [ - 'settings[handler_settings][negotate]' => 0, + 'settings[handler_settings][negate]' => 0, 'settings[handler_settings][target_bundles_drag_drop][paragraph_type_test][enabled]' => 1, ]; $this->drupalPostForm(NULL, $edit, 'Save settings'); @@ -193,7 +193,7 @@ class ParagraphsExperimentalConfigTest extends ParagraphsExperimentalTestBase { $this->drupalGet('admin/structure/types/manage/paragraphed_test/fields/node.paragraphed_test.paragraphs'); $edit = [ - 'settings[handler_settings][negotate]' => 1, + 'settings[handler_settings][negate]' => 1, 'settings[handler_settings][target_bundles_drag_drop][text][enabled]' => 1, ]; $this->drupalPostForm(NULL, $edit, 'Save settings');