110 }
111 />
112
113 { 'posts' === attributes.ChooseType && (114 <TokenCategoriesSelect/>
115 )}
116
247 { attributes.ShowCaption
248 && ( <ToggleControl
249 label={
250 'posts' === attributes.ChooseType251 ? __( 'Link titles', 'ekiline-collection' )
252 : __( 'Link images', 'ekiline-collection' )
253 }
183 />
184 ) }
185
186 { 'none' !== attributes.FindBlock && (187 <ToggleControl
188 label={ __( 'Show post if there is no block', 'ekiline-collection' ) }
189 checked={ attributes.AllowMixed }
166 />
167 ) }
168
169 { 'posts' === attributes.ChooseType && (170 <SelectControl
171 label={ __( 'Find a block in content', 'ekiline-collection' ) }
172 value={ attributes.FindBlock }
148 />
149 ) }
150
151 { 'posts' === attributes.ChooseType && (152 <SelectControl
153 label={ __( 'Sort by', 'ekiline-collection' ) }
154 value={ attributes.SetOrderBy }
Yoda conditions are named so because the literal value of the condition comes first while the variable comes second.
For instance,
if ("red" === color) {
// ...
}
Yoda condition is fixed by switching the literal and variable.
This is called a Yoda condition because it reads as, "if red equals the color", similar to the way the Star Wars character Yoda speaks. Compare to the other way of arranging the operands:
if (color === "red") {
// ...
}
This typically reads, "if the color equals red", which is arguably a more natural way to describe the comparison.
if ("red" === color) {
// ...
}
if (true == flag) {
// ...
}
if (5 > count) {
// ...
}
if (-1 < str.indexOf(substr)) {
// ...
}
if (color === "red") {
// ...
}
if (flag === true) {
// ...
}
if (count < 5) {
// ...
}
if (str.indexOf(substr) > -1) {
// ...
}