src/Form.php
private function pagesAddNext($pagesNext = array())
    {
        $this->debug->groupCollapsed(__METHOD__);
        $pagesNext = \array_values($pagesNext);
        $pages = $this->persist->get('pages');
        $iCur = $this->persist->get('i');
        $currentPage = $pages[ $iCur ];
        // offset is where we will insert pagesNext
        $offset = $iCur + \count($currentPage['addPages']) + 1;
        foreach ($pages as $k => $page) {
            foreach ($page['addPages'] as $k2 => $i) {
                if ($i >= $offset) {
                    $pages[$k]['addPages'][$k2] += \count($pagesNext);
                }
            }
        }
        foreach ($pagesNext as $i => $pageName) {
            $pages[$k]['addPages'][] = $offset + $i;
            \array_splice($pages, $offset + $i, 0, array(
                array(
                    'name' => $pageName,
                    'completed' => false,
                    'values' => array(),
                    'addPages' => array(),
                )
            ));
        }
        $this->persist->set('pages', $pages);
        $this->debug->groupEnd();
    }
private function pagesAddNext($pagesNext = array())
    {
        $this->debug->groupCollapsed(__METHOD__);
        $pagesNext = \array_values($pagesNext);
        $pages = $this->persist->get('pages');
        $iCur = $this->persist->get('i');
        $currentPage = $pages[ $iCur ];
        // offset is where we will insert pagesNext
        $offset = $iCur + \count($currentPage['addPages']) + 1;
        foreach ($pages as $k => $page) {
            foreach ($page['addPages'] as $k2 => $i) {
                if ($i >= $offset) {
                    $pages[$k]['addPages'][$k2] += \count($pagesNext);
                }
            }
        }
        foreach ($pagesNext as $i => $pageName) {
            $pages[$k]['addPages'][] = $offset + $i;
            \array_splice($pages, $offset + $i, 0, array(
                array(
                    'name' => $pageName,
                    'completed' => false,
                    'values' => array(),
                    'addPages' => array(),
                )
            ));
        }
        $this->persist->set('pages', $pages);
        $this->debug->groupEnd();
    }
private function pagesAddNext ( $ pagesNext = array ( ) ) { $ this -> debug -> groupCollapsed ( __METHOD__ ) ; $ pagesNext = \ array_values ( $ pagesNext ) ; $ pages = $ this -> persist -> get ( 'pages' ) ; $ iCur = $ this -> persist -> get ( 'i' ) ; $ currentPage = $ pages [ $ iCur ] ; // offset is where we will insert pagesNext $ offset = $ iCur + \ count ( $ currentPage [ 'addPages' ] ) + 1 ; foreach ( $ pages as $ k => $ page ) { foreach ( $ page [ 'addPages' ] as $ k2 => $ i ) { if ( $ i >= $ offset ) { $ pages [ $ k ] [ 'addPages' ] [ $ k2 ] += \ count ( $ pagesNext ) ; } } } foreach ( $ pagesNext as $ i => $ pageName ) { $ pages [ $ k ] [ 'addPages' ] [ ] = $ offset + $ i ; \ array_splice ( $ pages , $ offset + $ i , 0 , array ( array ( 'name' => $ pageName , 'completed' => false , 'values' => array ( ) , 'addPages' => array ( ) , ) ) ) ; } $ this -> persist -> set ( 'pages' , $ pages ) ; $ this -> debug -> groupEnd ( ) ; }
Add pages to be seen immediately after current page

@param array $pagesNext list of page names

@return void
Add pages to be seen immediately after current page