Not quite sure how to word this correctly, but I am looking for some help to to move/shift array keys so that the top level array doesn't contain another array with only one item. Basically from this:
[0] => Array
(
[0] => Array
(
[_id] => 3
[title] => Award winning wedding venue
[subtitle] => Creating a website to reflect the prestige of the brand
)
)
[1] => Array
(
[0] => Array
(
[_id] => 5
[title] => Bringing storytelling to life
[subtitle] => Bringing storytelling to life
)
)
to be like this:
[0] => Array
(
[_id] => 3
[title] => Award winning wedding venue
[subtitle] => Creating a website to reflect the prestige of the brand
)
[1] => Array
(
[_id] => 5
[title] => Bringing storytelling to life
[subtitle] => Bringing storytelling to life
)
Almost just shifting the array key up one.
The original array is created using the following:
// Start with manual relation otherwise default to next/prev
foreach ($item['related'] as $id) {
$related[] = perch_collection('Projects', [
'filter' => [
[
'filter' => '_id',
'match' => 'eq',
'value' => $id,
],
// Item is enabled
[
'filter' => 'status',
'match' => 'eq',
'value' => 'enabled',
],
],
'skip-template' => true,
], true);
}