I'm trying to make a form with a date selector with the 'enabled' checkbox. I added it like this:
$mform->addElement('date_selector', 'startdate', get_string('from'), ['optional' => true]);
The ['optional' => true] parameter added the checkbox, but it doesn't do anything. Am I supposed to implement that myself? I looked through the code for other date selectors but couldn't find any logic related to this, besides the 'optional' attribute.
