public function buildForm(array $form, FormStateInterface $form_state) {
$paragraph_selection_handler = $this
->getParagraphSelectionHandler();
// Set the form state to match the existing paragraph selection handler
// settings.
$fields = $this->entityFieldManager
->getFieldDefinitions('paragraphs_library_item', 'paragraphs_library_item');
$settings = $fields['paragraphs']
->getConfig('paragraphs_library_item')
->getSettings();
if (!empty($settings['handler_settings'])) {
// Since we are building a handler's form, have to move handler settings
// up to the same level as the rest of the config.
$handler_settings = $settings['handler_settings'];
unset($settings['handler_settings']);
$settings = array_merge($settings, $handler_settings);
$paragraph_selection_handler
->setConfiguration($settings);
}
// Build this form using the ParagraphsSelection form.
$form = $paragraph_selection_handler
->buildConfigurationForm($form, $form_state);
return parent::buildForm($form, $form_state);
}