php - Disable CheckboxField if other CheckboxField is not checked
one text
I want to have a CheckboxField to select if social icons should be shown in the website footer or not. My idea is to have a main CheckboxField to disable all of the icons and individual ones that are only enabled if the general one is checked. Otherwise they should be greyed out.
I thought about something like this (does not work).
CompositeField::create(
CheckboxField::create('ShowSozialIcons', 'Sozial Icons anzeigen'),
CheckboxField::create('ShowYoutubeIcon', 'Youtube Icon anzeigen')->setDisabled($this->ShowSozialIcons),
CheckboxField::create('ShowFacebookIcon', 'Facebook Icon anzeigen')->setDisabled($this->ShowSozialIcons),
CheckboxField::create('ShowInstagramIcon', 'Instagram Icon anzeigen')->setDisabled($this->ShowSozialIcons),
CheckboxField::create('ShowTwitterIcon', 'Twitter Icon anzeigen')->setDisabled($this->ShowSozialIcons),
CheckboxField::create('ShowLinkedinIcon', 'Linkedin Icon anzeigen')->setDisabled($this->ShowSozialIcons),
)->SetTitle('Anzuzeigende Elemente'),
Source