Adds a child to the front of the child list.

@param MenuPresenceInterface $presence
437341
public function shiftChild(MenuPresenceInterface $presence)
    {
        $children = $this->children ?: [];

        if ($children instanceof Collection) {
            $children->prepend($presence);
        } else {
            $children = array_prepend($children, $presence);
        }

        $this->children = $children;
    }
795506
public function addChildren($child) : void
    {
        Assert::isInstanceOfAny($child, [Chunk::class, Attribute::class]);
        $this->children[] = $child;
    }
1143355
public function moveBefore($entity)
    {
        if ($this->parent_id == $entity->parent_id) {
            $this->position = $entity->position - 1;
            $this->save();
        } else {
            $this->moveTo($entity->position - 1, $entity->parent_id);
        }
    }
285420
public function addProductionMenuItem(MenuCollectionEvent $event): void
    {
        $menu = $event->getMenu();

        // Create productions menu item.
        $productions = $this->factory->createItem('menu_item.productions', [
            'route' => 'bkstg_production_admin_index',
            'extras' => [
                'icon' => 'list',
                'translation_domain' => BkstgCoreBundle::TRANSLATION_DOMAIN,
            ],
        ]);
        $menu->addChild($productions);

        // Create productions menu item.
        $list = $this->factory->createItem('menu_item.productions', [
            'route' => 'bkstg_production_admin_index',
            'extras' => [
                'translation_domain' => BkstgCoreBundle::TRANSLATION_DOMAIN,
            ],
        ]);
        $productions->addChild($list);

        // Create productions menu item.
        $archive = $this->factory->createItem('menu_item.archive', [
            'route' => 'bkstg_production_admin_archive',
            'extras' => [
                'translation_domain' => BkstgCoreBundle::TRANSLATION_DOMAIN,
            ],
        ]);
        $productions->addChild($archive);
    }
1188502
public function accept(VisitorInterface $visitor): void
    {
        $visitor->visitBefore($this);

        foreach ($this->getChildren() as $node) {
            $node->accept($visitor);
        }

        $visitor->visitAfter($this);
    }
986847
public function addChild(ViewModelInterface $child, $groupId = null)
    {
        $this->children[] = $child;
        if (! is_null($groupId)) {
            $child->setGroupId($groupId);
        }

        return $this;
    }
269394
public function addChild(CategoryInterface $child)
    {
        $child->setParent($this);
        $this->children[] = $child;

        return $this;
    }
829729
public function populate(EnvironmentInterface $environment)
    {
        if (!$this->scopeDeterminator->currentScopeIsBackend()) {
            return;
        }

        $this->populateView($environment);
        $this->populatePanel($environment);
    }
481147
public function addChild(NodeInterface $node)
    {
        $name = $node->getName();
        if (!\strlen($name)) {
            throw new \InvalidArgumentException('Child nodes must be named.');
        }
        if (isset($this->children[$name])) {
            throw new \InvalidArgumentException(sprintf('A child node named "%s" already exists.', $name));
        }

        $this->children[$name] = $node;
    }
827261
public function showOnlyCurrentChildren(ItemInterface $menu)
    {
        $itemIterator = new RecursiveItemIterator($menu->getIterator());

        $iterator = new \RecursiveIteratorIterator($itemIterator, \RecursiveIteratorIterator::SELF_FIRST);
        foreach ($iterator as $menuItem) {
            /** @var \Knp\Menu\MenuItem $menuItem */
            if (!$this->matcher->isCurrent($menuItem) && !$this->matcher->isAncestor($menuItem)) {
                $menuItem->setDisplayChildren(false);
            }
        }
    }
360463
def bring_to_front(self):
        """"""
        if self.parent is not None:
            ch = self.parent.children
            index = ch.index(self)
            ch[-1], ch[index] = ch[index], ch[-1]
817861
public function addChild($child)
    {
        $child->parent = $this;
        $child->index = count($this->children);
        $this->children[] = $child;
    }
610074
public function addChild($name, $value = null, $namespace = null, $allowNull = true)
    {
        if (!$allowNull && $value === null) {
            return null;
        }
        if (!empty($value)) {
            $value = preg_replace(self::PATTERN_INVALID_CHARS, '', $value);
        }
        if ($value !== Shopgate_Model_AbstractExport::SET_EMPTY) {
            return parent::addChild($name, $value, $namespace);
        }
        $child = parent::addChild($name, '', $namespace);
        $child->addAttribute('forceEmpty', '1');

        return $child;
    }
296611
private function addMenuItems(Item $parent, array $menu): void
	{
		foreach ($menu as $name => $item) {

			if (array_key_exists('link', $item)) {
				$link = $parent->addLink($name, $item['link'], isset($item['arguments']) ? $item['arguments'] : []);
				if (!empty($item['toBlank'])) {
					$link->toBlank();
				}
				if (!empty($item['count'])) {
					$this->setCount($link, $item['count']);
				}
				unset($item['link'], $item['arguments'], $item['toBlank'], $item['count']);
			} else {
				$link = $parent->addGroup($name);
			}
			$this->addMenuItems($link, $item);
		}
	}
841462
public function add_children(& $node, $parentidnumber) {
        foreach ($this->flat as $competency) {
            if ($competency->parentidnumber == $parentidnumber) {
                $this->progress->increment_progress();
                $node->children[] = $competency;
                $this->add_children($competency, $competency->idnumber);
            }
        }
    }
628195
public function insertBefore(LeafInterface $child, LeafInterface $newChild)
    {

        if (!$this->hasChild($child))
            throw new TreeException(
                "Failed to insert before: Passed child is not a child of element to insert in"
            );

        $this->prepareChild($newChild);
        array_splice($this->children, $child->getIndex(), 0, [$newChild]);
        $this->finishChild($newChild);

        return $this;
    }
594414
public function addChildren($child) : void
    {
        Assert::isInstanceOfAny($child, [EntityDescriptor::class, EntitiesDescriptor::class]);
        $this->children[] = $child;
    }