bernhard Posted October 17, 2022 Share Posted October 17, 2022 Have you ever had a hard time setting the values of an options field via API? Grab RockOptionsAPI ? https://github.com/baumrock/RockOptionsApi RockOptionsApi ProcessWire module for easy manipulation of option-fields via API $page->getOptions('yourfield') ->add('foo') ->remove('bar') ->save(); Readonly options field renderer By default options fields that are set to readonly via the locked collapse state only show selected options and hide other available options. That might not be what you want. Here is an alternative that turns this: Into that: Simply call $form->readonlyOptions('yourfield') in the ProcessPageEdit::buildForm hook or when using MagicPages in the editForm() method: $wire->addHookAfter("ProcessPageEdit::buildForm", function($event) { $form = $event->return; $form->readonlyOptions('yourfield'); }); 5 Link to comment Share on other sites More sharing options...
bernhard Posted October 22, 2022 Author Share Posted October 22, 2022 v1.0.2: isChecked('foo') / isUnchecked('bar') ? 2 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now