Hey so I’m trying to figure out the correct steps for setting the Options List when adding an Attribute of type Select to an Express Object I’m building Programmatically… and falling on my face trying to figure it out… Can anyone help me please? This is what I have so far
$object = Express::buildObject('test1', 'test1', 'Test1');
$object->addAttribute('user_selector', 'Owner User', 'test_owner');
$settings = new \Concrete\Core\Entity\Attribute\Key\Settings\SelectSettings();
$settings->setAllowMultipleValues(false);
$settings->setDisplayMultipleValuesOnSelect(false);
$settings->setHideNoneOption(true);
$settings->setAllowOtherValues(false);
$list = ['test1', 'test2'];
$optionList = new \Concrete\Core\Entity\Attribute\Value\Value\SelectValueOptionList();
$optionList->setOptions($list);
$settings->setOptionList($optionList);
$object->addAttribute('select', 'Test Select', 'test_select', $settings);
$object->save();