Improvements to allow clone book entities.
1 unresolved thread
1 unresolved thread
Closes #3076356
Merge request reports
Activity
117 // This is the parent book. 118 $link = [ 119 'nid' => $cloned_entity->id(), 120 'bid' => 'new', 121 'pid' => 0, 122 'has_children' => $entity->book['has_children'], 123 'weight' => 0, 124 'depth' => 1, 125 ]; 126 $cloned_entity->book = $link; 127 $cloned_entity->save(); 128 129 // Clone book children. 130 $this->cloneBookPages($entity, $cloned_entity, $properties); 131 } 132 - Comment on lines +114 to +132
can we add condition:
114 // Clone books entities. 115 $bid = isset($entity->book) && empty($entity->book['bid']) ? 0 : $entity->book['bid']; 116 if (!empty($properties['clone_book']) && !empty($bid) && $entity->book['bid'] == $entity->id()) { 117 // This is the parent book. 118 $link = [ 119 'nid' => $cloned_entity->id(), 120 'bid' => 'new', 121 'pid' => 0, 122 'has_children' => $entity->book['has_children'], 123 'weight' => 0, 124 'depth' => 1, 125 ]; 126 $cloned_entity->book = $link; 127 $cloned_entity->save(); 128 129 // Clone book children. 130 $this->cloneBookPages($entity, $cloned_entity, $properties); 131 } 132 114 // Clone books entities. 115 if ($this->moduleHandler->moduleExist('book')) { 116 $bid = isset($entity->book) && empty($entity->book['bid']) ? 0 : $entity->book['bid']; 117 if (!empty($properties['clone_book']) && !empty($bid) && $entity->book['bid'] == $entity->id()) { 118 // This is the parent book. 119 $link = [ 120 'nid' => $cloned_entity->id(), 121 'bid' => 'new', 122 'pid' => 0, 123 'has_children' => $entity->book['has_children'], 124 'weight' => 0, 125 'depth' => 1, 126 ]; 127 $cloned_entity->book = $link; 128 $cloned_entity->save(); 129 130 // Clone book children. 131 $this->cloneBookPages($entity, $cloned_entity, $properties); 132 } 133 }
Please register or sign in to reply