@param Navigation $navigation

@return $this
333719
public function addNavigation(Navigation $navigation)
    {
        if (!$this->navigations->contains($navigation)) {
            $this->navigations->add($navigation);
            $navigation->setSiteroot($this);
        }

        return $this;
    }
509207
@Override
    public void onNavigationEvent(NavigationEvent event) {

        QName source = (QName)event.getSource();
        QName target = event.getTarget();

        //System.out.println("Navigate to " + target);

        InteractionUnit targetUnit = dialog.findUnit(target);
        if(targetUnit!=null)  // local to dialog
        {
            Procedure activateProcedure = procedures.getSingle(CommonQNames.ACTIVATION_ID);
            activateProcedure.getCommand().execute(dialog, target);
        }
        else // absolute, external
        {
            navigationDelegate.onNavigation(dialog.getId(), target); // TODO: dialog || unit as source?
        }


        Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {
            @Override
            public void execute() {
                InteractionCoordinator.this.reset();
            }
        });

    }
193915
public function __new($navigation = array())
    {
        // Create new entity
        $entity = new Material();
        $entity->Active = 1;
        $entity->Created = date('Y-m-d H:m:s');

        // Set user
        $user = $this->system->module('social')->user();

        if (isset($user->user_id)) {
            $entity->UserID = $user->userId;
        }
        else {
            $entity->UserID = '1';
        }

        // Persist
        $entity->save();

        // Set name for created material
        $entity->Name = t($this->name, true).' №'.$entity->id;
        $entity->Url = utf8_translit($entity->Name);

        // Check unique url for material
        if ($this->query->entity(Material::class)->where(Material::F_IDENTIFIER, utf8_translit($entity->Name))->first()) {
            $entity->Url = md5(utf8_translit($entity->Name));
        }

        // Persist
        $entity->save();

        Event::fire('samsoncms.app.material.new', array(&$entity));

        $navigation = is_array($navigation) ? $navigation : array($navigation);

        // Set navigation relation
        foreach (array_merge($navigation, static::$structures) as $structureID) {
            // Create relation with structure
            $structureMaterial = new NavigationMaterial();
            $structureMaterial->MaterialID = $entity->id;
            $structureMaterial->StructureID = $structureID;
            $structureMaterial->Active = '1';
            $structureMaterial->save();
        }

        // Go to correct form URL
        url()->redirect($this->system->module('cms')->baseUrl . '/' . $this->id . '/form/' . $entity->id);
    }
807427
public function add(navigation_node $node, $beforekey=null) {
        global $CFG;
        $key = $node->key;
        $type = $node->type;

        // First check we have a 2nd dimension for this type
        if (!array_key_exists($type, $this->orderedcollection)) {
            $this->orderedcollection[$type] = array();
        }
        // Check for a collision and report if debugging is turned on
        if ($CFG->debug && array_key_exists($key, $this->orderedcollection[$type])) {
            debugging('Navigation node intersect: Adding a node that already exists '.$key, DEBUG_DEVELOPER);
        }

        // Find the key to add before
        $newindex = $this->count;
        $last = true;
        if ($beforekey !== null) {
            foreach ($this->collection as $index => $othernode) {
                if ($othernode->key === $beforekey) {
                    $newindex = $index;
                    $last = false;
                    break;
                }
            }
            if ($newindex === $this->count) {
                debugging('Navigation node add_before: Reference node not found ' . $beforekey .
                        ', options: ' . implode(' ', $this->get_key_list()), DEBUG_DEVELOPER);
            }
        }

        // Add the node to the appropriate place in the by-type structure (which
        // is not ordered, despite the variable name)
        $this->orderedcollection[$type][$key] = $node;
        if (!$last) {
            // Update existing references in the ordered collection (which is the
            // one that isn't called 'ordered') to shuffle them along if required
            for ($oldindex = $this->count; $oldindex > $newindex; $oldindex--) {
                $this->collection[$oldindex] = $this->collection[$oldindex - 1];
            }
        }
        // Add a reference to the node to the progressive collection.
        $this->collection[$newindex] = $this->orderedcollection[$type][$key];
        // Update the last property to a reference to this new node.
        $this->last = $this->orderedcollection[$type][$key];

        // Reorder the array by index if needed
        if (!$last) {
            ksort($this->collection);
        }
        $this->count++;
        // Return the reference to the now added node
        return $node;
    }
1033786
public Query setPinnedRefinements(String navigationName, String... values) {
    Navigation navigation = navigations.get(navigationName);
    if (navigation == null) {
      navigation = new Navigation().setName(navigationName);
      navigations.put(navigationName, navigation);
    }
    navigation.setPinnedRefinements(asList(values));
    return this;
  }
516137
protected function findOrCreateGroup(Module $module, MenuBuilder $navigation, $group)
    {
        if (!$sub = $navigation->whereTitle($group)) {
            $sub = $navigation->dropdown($group, function () {
            }, 99, ['id' => $module->url(), 'icon' => 'fa fa-folder']);
        }

        return $sub;
    }
1268553
public function addNode(Node $node)
    {
        $node->setNavigation($this);
        $this->nodes[] = $node;

        return $this;
    }
593892
private void addNavigationPreference() {
        NavigationPreference navigationPreference = new NavigationPreference(this);
        navigationPreference.setTitle(getPreferenceHeaderTitle());
        navigationPreference.setFragment(NewPreferenceHeaderFragment.class.getName());
        getNavigationFragment().getPreferenceScreen().addPreference(navigationPreference);
        invalidateOptionsMenu();
    }
810633
public function setMenu(MenuNodeInterface $menu = null)
    {
        $this->menu = $menu;

        if ($menu->getNode() !== $this) {
            $menu->setNode($this);
        }

        return $this;
    }
1293972
protected function BackLink()
    {
        $module = new NavigationTree();
        $params = array('navigation'=>$this->navi->GetID());
        return BackendRouter::ModuleUrl($module, $params);
    }
708644
protected function _setNavigationElementFromRecord(CmsCategoryRecord $record, \Mmi\Navigation\NavigationConfigElement $element)
    {
        $params = [];
        parse_str($record->mvcParams, $params);
        $params['uri'] = $record->customUri ? $record->customUri : $record->uri;
        $config = $record->getConfig();
        $config->typeId = $record->cmsCategoryTypeId;
        $config->categoryId = $record->id;
        $element
            ->setModule('cms')
            ->setController('category')
            ->setAction('dispatch')
            ->setParams($params)
            ->setBlank($record->blank ? true : false)
            ->setDisabled($record->active ? false : true)
            ->setHttps($record->https)
            ->setUri($record->redirectUri ? : null)
            ->setLabel($record->name)
            ->setLang($record->lang)
            ->setFollow($record->follow ? true : false)
            ->setConfig($config)
            ->setDateStart($record->dateStart)
            ->setDateEnd($record->dateEnd);
		if ($record->title) {
			$element->setTitle($record->title);
		}
		if ($record->description) {
			$element->setDescription($record->description);
		}
        return $this->_setNavigationElementRoles($record, $element);
    }
882071
public function setNavigationClass($class) {
        if(is_string($class) && !empty(trim($class))){
            $this->menuElements['ul_class'] = $class;
        }
        if((is_string($class) && empty(trim($class))) || $class === false){
            $this->menuElements['ul_class'] = '';
        }
        return $this;
    }
1304476
public function setParent(\Wucdbm\Bundle\MenuBuilderBundle\Entity\MenuItem $parent = null) {
        $this->parent = $parent;

        return $this;
    }
134176
public static function getMenu()
    {
        return (new \Mmi\Navigation\NavigationConfigElement)
            ->setLabel('menu.text.container')
            ->setIcon('fa-align-left')
            ->setUri('#')
            ->addChild((new \Mmi\Navigation\NavigationConfigElement)
                ->setLabel('menu.text.index')
                ->setIcon('fa-table')
                ->setModule('cmsAdmin')
                ->setController('text'))
            ->addChild((new \Mmi\Navigation\NavigationConfigElement)
                ->setLabel('menu.text.edit')
                ->setIcon('fa-plus')
                ->setModule('cmsAdmin')
                ->setController('text')
                ->setAction('edit'));
    }
966163
public function navigate()
	{
		if ($this->url)
		{
			$this->session->url($this->url);
		}
		else
		{
			$this->session->navigate($this->presenterName, $this->presenterParameters);
		}
		return $this;
	}
474919
private function _prepareNavModel($attributes): NavigationModel
    {
        $model = new NavigationModel();

        $model->layoutId = $attributes['layoutId'];
        $model->handle = $attributes['handle'];
        $model->currLabel = $attributes['label'];
        $model->prevLabel = $attributes['label'];
        $model->enabled = true;
        $model->order = $attributes['order'];
        $model->url = $attributes['url'];
        $model->prevUrl = $attributes['url'];
        $model->icon = $attributes['icon'];
        $model->manualNav = false;
        $model->newWindow = false;

        return $model;
    }
220754
public function build(): SetNavigatorOverridesRequest
	{
		$instance = new SetNavigatorOverridesRequest();
		if ($this->platform === null) {
			throw new BuilderException('Property [platform] is required.');
		}
		$instance->platform = $this->platform;
		return $instance;
	}