OLSA Posted June 27, 2015 Share Posted June 27, 2015 Hello, I had a problem with this part of code: $field = $modules->get("InputfieldSelect"); $field->label = $el['label-children']; $field->attr('id+name','children'); //=> this line was a problem $field->attr("wrapClass", "large-4 columns"); $options = array('0','1','2','3','4','5','6','7','8','9','+10'); foreach($options as $k => $v) { $field->addOption($k, $v); } $form->append($field); and later in some loop I had a trouble foreach( $form->children as $f ) { ... } Because I am still learning Processwire maybe it would be nice to have some kind of "List of reserved words". My mistake was that I didn't give importance about "children" in this part: $field->attr('id+name','children'); because I was thinking: ok it will create select field with id="children" and name="children" But that was wrong Regards, Sasa Link to comment Share on other sites More sharing options...
LostKobrakai Posted June 27, 2015 Share Posted June 27, 2015 Here you go: https://github.com/ryancramerdesign/ProcessWire/blob/master/wire/core/Fields.php#L30. 1 Link to comment Share on other sites More sharing options...
OLSA Posted June 27, 2015 Author Share Posted June 27, 2015 Here you go: https://github.com/ryancramerdesign/ProcessWire/blob/master/wire/core/Fields.php#L30. Thank you LostKobrakai. Link to comment Share on other sites More sharing options...
Can Posted January 28, 2016 Share Posted January 28, 2016 Just stumbled upon a failing field name, too. In PW3 "files" is reserved, as not only those names from LostKobrakai's mentioned array are considered reserved, but everything in $wire too. https://github.com/ryancramerdesign/ProcessWire/blob/master/wire/modules/Process/ProcessField/ProcessField.module#L1439 and in PW3 there's WireFileTools class which populates $files 1 Link to comment Share on other sites More sharing options...
szabesz Posted January 29, 2016 Share Posted January 29, 2016 Using your own two or three character prefix (plus _ or -) to name identifiers can be of help no matter what system we use (css, php, js, etc...). This way it is also easy to tell what belongs to your code and what not. It helps in this issue, but also helps others dealing with your code. Sure, the practice of prefixing is not a bulletproof solution, but it is unlikely that one runs into this issue when sticking to it. 1 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