Hi,
I am looking to create a kind of ‘auto publish’ publish feature for an array of Slides.
I have the following data structure, notice the published
field
fields:
-
slideimage:
- slider-image.jpg
heading: MHYSA
headingcolour: white
blurb: >
Duis aute irure dolor in reprehenderit
in voluptate velit esse cillum dolore eu
fugiat nulla pariatur. Excepteur sint
occaecat cupidatat non proident.
link: http://localhost:3000/discover
newtab: 'false'
published: 'true'
-
slideimage:
- underwater.gif
heading: 'Stocks & Shares'
headingcolour: white
blurb: >
Duis aute irure dolor in reprehenderit
in voluptate velit esse cillum dolore eu
fugiat nulla pariatur. Excepteur sint
occaecat cupidatat non proident.
link: https://noodsradio.myshopify.com/
newtab: 'true'
published: 'false'
-
slideimage:
- keith-image.jpg
heading: In Fine Style with Wilfy D
headingcolour: white
blurb: >
Duis aute irure dolor in reprehenderit
in voluptate velit esse cillum dolore eu
fugiat nulla pariatur. Excepteur sint
occaecat cupidatat non proident.
link: >
http://localhost:3000/shows/back-to-the-future-cosmic-80s-breakfast-show-w-murphy-mcfly-15th-april-20
newtab: 'false'
published: 'false'
...
I would like to know how I would update the published
field to be true
At the moment I have the following code, I’m updating another toggle field on the page as a test. This doesn’t seem to be working…
'bvdputte.kirbyqueue.queues' => [
'home' => function ($home) {
$field = 'featuredartistsslotone';
$fieldData = false;
try {
$newPage = page('home')->update(array($field => $fieldData));
return true;
} catch (Exception $e) {
return $e->getMessage();
}
// No need to return or display anything else!
}
],