PagesEditor::editor method

Set page $sort value and increment siblings having same or greater sort value

  • This method is primarily applicable if configured sortfield is manual “sort” (or “none”).
  • This is typically used after a move, sort, clone or delete operation.

Usage

// basic usage
$int = $pages->editor->sortPage(Page $page);

// usage with all arguments
$int = $pages->editor->sortPage(Page $page, $sort = null, bool $after = false);

Arguments

NameType(s)Description
$pagePage

Page that you want to set the sort value for

$sort (optional)int null

New sort value for page or null to pull from $page->sort

$after (optional)bool

If another page already has the sort, make $page go after it rather than before it? Default:false

Return value

int

Number of sibling pages that had to have sort adjusted

Exceptions

Method can throw exceptions on error:

  • WireException - if given invalid arguments


$pages->editor methods and properties

API reference based on ProcessWire core version 3.0.252