develop #63
|
@ -2,13 +2,15 @@
|
|||
|
||||
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) {
|
||||
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";
|
||||
|
@ -16,14 +18,14 @@ foreach ($response_items as $menu_item) {
|
|||
$item = [
|
||||
"ID" => $menu_item->ID,
|
||||
"title" => $menu_item->title,
|
||||
"url" => $item_url,
|
||||
"menu_item_parent" => $menu_item->menu_item_parent,
|
||||
"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;
|
||||
}
|
||||
}
|
||||
|
||||
//print_r($items);
|
||||
|
||||
|
|
Loading…
Reference in New Issue