Hello everyone how are you?
I created a new configEntity called Modal with 3 fields:
- Label
- Body
- Auto Open
To create a new Modal I'm using this code:
$modal = \Drupal::entityTypeManager()->getStorage('modal')->create();
$modal->setLabel('Modal Title');
$modal->setBody('Modal Content');
$modal->setAutoOpen(TRUE);
$modal->save();
OK! It works!
But now I don't want to pass "auto-open" and I this value with TRUE as default. Like this:
$modal = \Drupal::entityTypeManager()->getStorage('modal')->create();
$modal->setLabel('Modal Title');
$modal->setBody('Modal Content');
$modal->save();
Note that there is no "Auto-Open" and it inserts a new Modal with "auto-open" = FALSE
My goal is; if you don't pass "auto-open" this field is filled with TRUE by default.
Do you know how can we do this? 🤔
Thank you so much, everyone
FALSE
?! How did you create the config entity? – leymannx Nov 9 '20 at 14:21