I need to create a config page, that is able to add social media information ( name and icon ), the user must be able to add as many social medias as it wants. To do so, I'we created a paragraph with two fields: name & icon, then I want to add this paragraph as an entity reference field programmaticaly in my config page, the paragraph machine name is social_media.
I tried this, but it didn't work:
public function buildForm(array $form, FormStateInterface $form_state) { $form['social_media_fieldset'] = [ '#type' => 'fieldset', '#title' => $this->t('Social Media Configuration'), '#collapsible' => TRUE, '#collapsed' => FALSE, ]; $field = BaseFieldDefinition::create('entity_reference') ->setLabel(t('Type')) ->setDescription(t('The Paragraphs type.')) ->setSetting('target_type', 'paragraph') ->setSetting('handler', 'default') ->setSetting('handler_settings',['target_bundles'=> ['social_media'=>'social_media'] ]); $form['social_media'] = $field; return parent::buildForm($form, $form_state); } the page is shown but without a form:

entityreferenceelement type - maybe you meantentity_autocomplete?