You are here

protected function EntityMenuLinkCloneForm::createMenuLinkClone 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::createMenuLinkClone()
  2. 8.2 src/Form/EntityMenuLinkCloneForm.php \Drupal\menu_link_clone\Form\EntityMenuLinkCloneForm::createMenuLinkClone()

Create menu links.

Parameters

object $menu_links_object_multiple: Menu Items Object.

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

File

src/Form/EntityMenuLinkCloneForm.php, line 186

Class

EntityMenuLinkCloneForm
Provides a menu link clone form.

Namespace

Drupal\menu_link_clone\Form

Code

protected function createMenuLinkClone($menu_links_object_multiple) {
  $result = FALSE;
  foreach ($menu_links_object_multiple as $id => $menu) {
    unset($menu['revision_id']);
    unset($menu['bundle']);
    $save_menu = MenuLinkContent::create($menu);
    $save_menu
      ->save();
    if ($save_menu) {
      $result = TRUE;
    }
  }
  return $result;
}