original_string: protected function doReorder($new_order)
      {
          if (!$this->_original) {
              return;
          }
  
          $pages = Grav::instance()['pages'];
          $pages->init();
  
          $this->_original->path($this->path());
  
          $parent = $this->parent();
          $siblings = $parent ? $parent->children() : null;
  
          if ($siblings) {
              $siblings->order('slug', 'asc', $new_order);
  
              $counter = 0;
  
              // Reorder all moved pages.
              foreach ($siblings as $slug => $page) {
                  $order = (int)trim($page->order(), '.');
                  $counter++;
  
                  if ($order) {
                      if ($page->path() === $this->path() && $this->folderExists()) {
                          // Handle current page; we do want to change ordering number, but nothing else.
                          $this->order($counter);
                          $this->save(false);
                      } else {
                          // Handle all the other pages.
                          $page = $pages->get($page->path());
                          if ($page && $page->folderExists() && !$page->_action) {
                              $page = $page->move($this->parent());
                              $page->order($counter);
                              $page->save(false);
                          }
                      }
                  }
              }
          }
      }
code: protected function doReorder($new_order)
      {
          if (!$this->_original) {
              return;
          }
  
          $pages = Grav::instance()['pages'];
          $pages->init();
  
          $this->_original->path($this->path());
  
          $parent = $this->parent();
          $siblings = $parent ? $parent->children() : null;
  
          if ($siblings) {
              $siblings->order('slug', 'asc', $new_order);
  
              $counter = 0;
  
              // Reorder all moved pages.
              foreach ($siblings as $slug => $page) {
                  $order = (int)trim($page->order(), '.');
                  $counter++;
  
                  if ($order) {
                      if ($page->path() === $this->path() && $this->folderExists()) {
                          // Handle current page; we do want to change ordering number, but nothing else.
                          $this->order($counter);
                          $this->save(false);
                      } else {
                          // Handle all the other pages.
                          $page = $pages->get($page->path());
                          if ($page && $page->folderExists() && !$page->_action) {
                              $page = $page->move($this->parent());
                              $page->order($counter);
                              $page->save(false);
                          }
                      }
                  }
              }
          }
      }
code_tokens: protected function doReorder ( $ new_order ) { if ( ! $ this -> _original ) { return ; } $ pages = Grav :: instance ( ) [ 'pages' ] ; $ pages -> init ( ) ; $ this -> _original -> path ( $ this -> path ( ) ) ; $ parent = $ this -> parent ( ) ; $ siblings = $ parent ? $ parent -> children ( ) : null ; if ( $ siblings ) { $ siblings -> order ( 'slug' , 'asc' , $ new_order ) ; $ counter = 0 ; // Reorder all moved pages. foreach ( $ siblings as $ slug => $ page ) { $ order = ( int ) trim ( $ page -> order ( ) , '.' ) ; $ counter ++ ; if ( $ order ) { if ( $ page -> path ( ) === $ this -> path ( ) && $ this -> folderExists ( ) ) { // Handle current page; we do want to change ordering number, but nothing else. $ this -> order ( $ counter ) ; $ this -> save ( false ) ; } else { // Handle all the other pages. $ page = $ pages -> get ( $ page -> path ( ) ) ; if ( $ page && $ page -> folderExists ( ) && ! $ page -> _action ) { $ page = $ page -> move ( $ this -> parent ( ) ) ; $ page -> order ( $ counter ) ; $ page -> save ( false ) ; } } } } } }
docstring: Reorders all siblings according to a defined order
  
  @param array|null $new_order
docstring_tokens: Reorders all siblings according to a defined order