Basically if a variable isn’t set then set it to another value.
There must be a better way, this looks so messy.
if ($image_src === undefined) {
$image_src = $apple_icon;
}
if ($image_src === undefined) {
$image_src = $apple_icon2;
}
if ($image_src === undefined) {
$image_src = $item_prop_image;
}
if ($image_src === undefined) {
$image_src = $image_first;
}
In JavaScript you can use the or
||operator to condense things that are undefined. So this is valid: