You are here

protected function EntityMenuLinkCloneForm::resetLinkItems in Menu Link Clone 8

Same name and namespace in other branches
  1. 8.3 src/Form/EntityMenuLinkCloneForm.php \Drupal\menu_link_clone\Form\EntityMenuLinkCloneForm::resetLinkItems()
  2. 8.2 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.

1 call to EntityMenuLinkCloneForm::resetLinkItems()
EntityMenuLinkCloneForm::cloneMenuLinks in src/Form/EntityMenuLinkCloneForm.php
Clone menu items.

File

src/Form/EntityMenuLinkCloneForm.php, line 140

Class

EntityMenuLinkCloneForm
Provides a menu link clone form.

Namespace

Drupal\menu_link_clone\Form

Code

protected function resetLinkItems($menu_links_object_multiple) {
  $result = [];
  foreach ($menu_links_object_multiple as $link) {
    if (!empty($link)) {
      $linkArray = $link
        ->toArray();
      foreach ($linkArray as $key => $linkArrayItem) {
        $linkData[$key] = reset($linkArrayItem);
      }
      $result[$link
        ->id()] = $linkData;
    }
  }
  return $result;
}