Created
June 1, 2020 14:57
-
-
Save lcube45/a566915181c2b312c05734d15d4329f7 to your computer and use it in GitHub Desktop.
Drupal 8 - BaseFieldDefinition - entity_reference_revisions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// si limitation sur les bundles de paragraphes: renseigner target_bundles | |
// ajout du widget de paragraphs "classic paragraphs | |
$fields['paragraphs'] = BaseFieldDefinition::create('entity_reference_revisions') | |
->setLabel('Paragraphs') | |
->setDescription('Paragraphs') | |
->setCardinality(FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED) | |
->setRequired(TRUE) | |
->setSetting('handler_settings', ['target_bundles' => []]) | |
->setDisplayConfigurable('view', TRUE) | |
->setDisplayConfigurable('form', TRUE) | |
->setSetting('target_type', 'paragraph') | |
->setDisplayOptions('form', [ | |
'type' => 'entity_reference_paragraphs' | |
]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Un exemple de BasefieldDefinition pour le type de champ "entity_reference_revisions" permettant de gérer des paragraphes