protected function EntityMenuLinkCloneForm::resetLinkItems in Menu Link Clone 8.2
Same name and namespace in other branches
- 8.3 src/Form/EntityMenuLinkCloneForm.php \Drupal\menu_link_clone\Form\EntityMenuLinkCloneForm::resetLinkItems()
- 8 src/Form/EntityMenuLinkCloneForm.php \Drupal\menu_link_clone\Form\EntityMenuLinkCloneForm::resetLinkItems()
Reset elements in menu item object.
Parameters
object $menu_links_object_multiple: Menu Items Object.
Return value
array Retrun array with there menu items tree.
1 call to EntityMenuLinkCloneForm::resetLinkItems()
- EntityMenuLinkCloneForm::cloneMenuLinks in src/
Form/ EntityMenuLinkCloneForm.php - Clone menu items.
File
- src/
Form/ EntityMenuLinkCloneForm.php, line 187
Class
- EntityMenuLinkCloneForm
- Provides a menu link clone form.
Namespace
Drupal\menu_link_clone\FormCode
protected function resetLinkItems($menu_links_object_multiple) {
$result = [];
foreach ($menu_links_object_multiple as $link) {
if (!empty($link)) {
$linkArray = $link
->toArray();
$linkData = [];
foreach ($linkArray as $key => $linkArrayItem) {
$linkData[$key] = reset($linkArrayItem);
}
$result[$link
->id()] = $linkData;
}
}
return $result;
}