renobird Posted April 25, 2014 Posted April 25, 2014 I'm building a module where I need to set a field to locked, but not collapsed. I can set it to collapsed/locked like so: $field->collapsed = Inputfield::collapsedLocked; But looking for a way to do the same thing, but have the field default to open. There currently isn't an option for "openLocked". Any ideas on how to get around this? I'm feeling a little dense here at the end of the week. 1
teppo Posted April 25, 2014 Posted April 25, 2014 (edited) According to Inputfield.php, collapsedLocked should be exactly what you're looking for: visible, but not editable. Is the description there outdated or am I missing something here? Edit: right, "otherwise same as collapsedYes".. that's a bummer. Sorry, can't see an obvious way to do this without some custom hooks right now. Edited April 25, 2014 by teppo 1
Soma Posted April 25, 2014 Posted April 25, 2014 Ok, first take off your mask and try some harder. Collapsed sound more like well collapsed , not? 1
netcarver Posted April 25, 2014 Posted April 25, 2014 @teppo I don't think Tom wants to have his users click to open the field. He just wants the locked value displayed uncollapsed. 1
renobird Posted April 25, 2014 Author Posted April 25, 2014 Steve, Exactly. I need this to be a locked field, but it needs to default to open. CollapsedLocked defaults to (obviously) collapsed.
netcarver Posted April 25, 2014 Posted April 25, 2014 @renobird You should open an "issue" on github for this new functionality. 2
Macrura Posted April 26, 2014 Posted April 26, 2014 i was wondering this same thing a few days ago, have a template where the title field is changed on page save, so don't want it editable, but needs to be visible...
netcarver Posted April 26, 2014 Posted April 26, 2014 (edited) I managed to add this functionality to my local copy of PW. Will make a pull request out of it this evening and submit it to Ryan for his consideration. Update: PR submitted. Edited April 26, 2014 by netcarver 5
renobird Posted April 28, 2014 Author Posted April 28, 2014 Cool! Thanks Steve. Perhaps eventually changing $field->collapsed to something like $field->state might simplify the naming?
netcarver Posted May 5, 2014 Posted May 5, 2014 Updated PR has been merged into the dev branch. https://github.com/ryancramerdesign/ProcessWire/pull/457 2
renobird Posted May 5, 2014 Author Posted May 5, 2014 Cool. Thanks Steve! I made the changes locally after you posted them last week. Seems to be working great.
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