You are here

protected function EntityMenuLinkCloneForm::cloneMenuLinks in Menu Link Clone 8.3

Same name and namespace in other branches
  1. 8 src/Form/EntityMenuLinkCloneForm.php \Drupal\menu_link_clone\Form\EntityMenuLinkCloneForm::cloneMenuLinks()
  2. 8.2 src/Form/EntityMenuLinkCloneForm.php \Drupal\menu_link_clone\Form\EntityMenuLinkCloneForm::cloneMenuLinks()

Clone menu items.

Parameters

object $source_menu_name: Source menu name from we need to clone the menu items.

string $target_menu_name: Destination menu name to clone the menu items.

Return value

bool Return the True or False.

1 call to EntityMenuLinkCloneForm::cloneMenuLinks()
EntityMenuLinkCloneForm::submitForm in src/Form/EntityMenuLinkCloneForm.php
Form submission handler.

File

src/Form/EntityMenuLinkCloneForm.php, line 123

Class

EntityMenuLinkCloneForm
Provides a menu link clone form.

Namespace

Drupal\menu_link_clone\Form

Code

protected function cloneMenuLinks($source_menu_name, $target_menu_name) {
  $result = FALSE;
  $menuLinkItems = $this
    ->getMenuItems($source_menu_name);
  if ($menuLinkItems['status']) {
    $data = $this
      ->resetLinkItems($menuLinkItems['items']);
    $data = $this
      ->setUuidForMenuItems($data, $target_menu_name);
    $data = $this
      ->createMenuLinkClone($data);
    if ($data) {
      $result = TRUE;
    }
  }
  return $result;
}