Adding Express Attribute Checkbox From an Install Package That is Checked by Default

Hey all. I know there is a place at the end for settings but I can’t figure out the syntax.
$attendee->addAttribute(‘boolean’, ‘Active’, ‘attendee_active’, what-the-heck-goes-here);
Can anyone shed some light on this?
Thanks in advance.
C

Hi @Chrouglas - I think you’re looking for an Attribute Key Settings Object:
https://documentation.concretecms.org/api/9.1.1/Concrete/Core/Express/ObjectBuilder.html#method_addAttribute

Which should be defined here:
https://documentation.concretecms.org/api/9.1.1/Concrete/Core/Entity/Attribute/Key/Settings/Settings.html

Let me know if that does the trick.

That did it. Thanks.

I also found help here… GitHub - shahroq/whale_c5_cheat_sheet: concrete5 Cheat Sheet but pieced it together with what you sent since the boolean settings weren’t mentioned.

For those who, like me, code-by-google, here is the final code.

$settings = new \Concrete\Core\Entity\Attribute\Key\Settings\BooleanSettings();
$settings->isCheckedByDefault();
$attendee->addAttribute('boolean', 'Active', 'attendee_active', $settings);

Thanks again.
C