smallrecords icon indicating copy to clipboard operation
smallrecords copied to clipboard

false is considered as a value

Open charles-tainui opened this issue 5 years ago • 3 comments

hello,

i've noticed that properties having default value set to "false" are considered as having a value when they are tested with "if" (ie : if ($this->property('useMainCategory')))

But value is set to zero when property checkbox is checked twice, once for checking, once for unchecking ; and then testing with "if" reacts as expected.

Hope i am clear … Regards

PS : thumbs up for your great development !

charles-tainui avatar Jan 22 '20 15:01 charles-tainui

Hi @charles-tainui,

the type of this property (useMainCategory) is checkbox and all default values are true or false.

You have problems using this with any of component?

PS: I have set in RecordDetail default value to true while all others are false. Can this be the problem?

jan-vince avatar Mar 02 '20 19:03 jan-vince

hello @jan-vince ,

i've just tested to add Records component (as a snippet) to content field of a Staticpage, the initial code is : <figure data-component="\JanVince\SmallRecords\Components\Records" data-inspector-id="inspectorid-310544570422" data-property-activeonly="true" data-property-allowlimit="false" data-property-areaslug="parutions-presse" data-property-categoryslug="{{ :category }}" data-property-favouriteonly="false" data-property-limit="10" data-property-orderascollection="false" data-property-orderby="name" data-property-orderbydirection="ASC" data-property-pageslug="{{ :page }}" data-property-recordpage="false" data-property-recordpageslug="{{ :record }}" data-property-tagslug="{{ :tag }}" data-property-usemaincategory="false" data-property-usemulticategories="0" data-snippet="records">&nbsp;</figure> Nothing is displayed.

Then i replace "false" by "0" : <figure data-component="\JanVince\SmallRecords\Components\Records" data-inspector-id="inspectorid-310544570422" data-property-activeonly="true" data-property-allowlimit="0" data-property-areaslug="parutions-presse" data-property-categoryslug="{{ :category }}" data-property-favouriteonly="0" data-property-limit="10" data-property-orderascollection="0" data-property-orderby="name" data-property-orderbydirection="ASC" data-property-pageslug="{{ :page }}" data-property-recordpage="0" data-property-recordpageslug="{{ :record }}" data-property-tagslug="{{ :tag }}" data-property-usemaincategory="0" data-property-usemulticategories="0" data-snippet="records">&nbsp;</figure> and my records show up

i feel (an do not understand why) taht "false" is considered as a string instead of a boolean

charles-tainui avatar Mar 19 '20 18:03 charles-tainui

Hi and thanks for your info.

I have never used that in Static Pages so I have no experience (bad or good).

But a problem with non-boolean false value is reported on GitHub - i will check that.

Best regards,

Jan

    1. 2020 v 19:18, CHAUVIN Charles [email protected]:

hello @jan-vince https://github.com/jan-vince ,

i've just tested to add Records component to content field of a Staticpage, the initial code is :

 
Nothing is displayed.

Then i replace "false" by "0" :

 
and my records show up

i feel (an do not understand why) taht "false" is considered as a string instead of a boolean

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/jan-vince/smallrecords/issues/62#issuecomment-601338185, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAINT757E5CX5KN2TZCZETLRIJOXJANCNFSM4KKHVP7A.

jan-vince avatar Mar 19 '20 19:03 jan-vince