wordpress-menu #56

Merged
chris merged 49 commits from wordpress-menu into develop 2022-03-25 13:12:29 +01:00
1 changed files with 19 additions and 17 deletions
Showing only changes of commit 3657873be7 - Show all commits

View File

@ -2,27 +2,29 @@
use Zend\Http\Client;
$client = New Client;
$client = new Client('https://dev.arc-hive.zone/wp-json/menus/v1/menus/4');
$client->setOptions(array("timeout"=>1));
$response = $client->send();
$response_items = json_decode($response->getBody());
$items = new ArrayObject();
$response_data = json_decode($response->getBody());
$items = new ArrayObject;
$items[0] = new ArrayObject();
foreach ($response_items as $menu_item) {
$item_url = $menu_item->url;
if (strtolower($menu_item->title) == 'login') {
$item_url = "/login";
if (!$response->isClientError()&& $response_data) {
foreach ($response_data as $menu_item) {
$item_url = $menu_item->url;
if (strtolower($menu_item->title) == 'login') {
$item_url = "/login";
}
$item = [
"ID" => $menu_item->ID,
"title" => $menu_item->title,
"url" => $item_url
];
if (!array_key_exists($menu_item->menu_item_parent, $items)) {
$items[$menu_item->menu_item_parent] = new ArrayObject();
}
$items[$menu_item->menu_item_parent][$menu_item->ID] =$item;
}
$item = [
"ID" => $menu_item->ID,
"title" => $menu_item->title,
"url" => $item_url,
"menu_item_parent" => $menu_item->menu_item_parent,
];
if (!array_key_exists($menu_item->menu_item_parent, $items)) {
$items[$menu_item->menu_item_parent] = new ArrayObject();
}
$items[$menu_item->menu_item_parent][$menu_item->ID] =$item;
}
//print_r($items);