joe_g Posted September 22, 2021 Share Posted September 22, 2021 Hi there, Is there a more elegant way to check if there is at least one item in an image array, currently do if($page->images && $page->images->first) - too long! tx! Link to comment Share on other sites More sharing options...
Zeka Posted September 22, 2021 Share Posted September 22, 2021 Hi. You can try to use $page->if() https://processwire.com/api/ref/page/if/ if($page->if('image')) { // ... } $page->if('image', function($image) { // ... }) 3 Link to comment Share on other sites More sharing options...
joe_g Posted September 22, 2021 Author Share Posted September 22, 2021 Yes! Thank you!! 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