class PageModel (View source)

The Page model.

Methods

static string
add(Page $Parent, string $title, string $themeTemplate, bool $isPrivate)

Add page.

static string
contextUrlByPath(string $path)

Return updated view URL based on $path.

static bool
delete(Page $Page, string $title)

Delete page.

static string
duplicate(Page $Page)

Duplicate a page.

static string
extractPrefixFromPath(string $path)

Extract the deepest directory's prefix from a given path.

static string
extractSlugFromPath(string $path)

Extract the slug without the prefix from a given path.

static string
getPageFilePath(Page $Page)

Return the full file system path of a page's data file.

static string
moveDirAndUpdateLinks(Page $Page, string $destPath, string $prefix, string $slug)

Move a page directory and update all related links.

static string
save(Page $Page, string $url, array $data, string $themeTemplate, string $prefix, string $slug)

Save page data.

static string
updateSlug(string $currentTitle, string $newTitle, string $slug)

Update slug in case it is not a custom one and just represents a sanitized version of the title.

static bool
updatePageLinks(Page $Page, string $newPath)

Update all file and page links based on a new path.

static string
urlByPath(Automad $Automad, string $path)

Return updated page URL based on $path.

Details

static string add(Page $Parent, string $title, string $themeTemplate, bool $isPrivate)

Add page.

Parameters

Page $Parent
string $title
string $themeTemplate
bool $isPrivate

Return Value

string the URL to the new page

static string contextUrlByPath(string $path)

Return updated view URL based on $path.

Parameters

string $path

Return Value

string The view URL to the new page

static bool delete(Page $Page, string $title)

Delete page.

Parameters

Page $Page
string $title

Return Value

bool true on success

static string duplicate(Page $Page)

Duplicate a page.

Parameters

Page $Page

Return Value

string the new URL

static string extractPrefixFromPath(string $path)

Extract the deepest directory's prefix from a given path.

Parameters

string $path

Return Value

string Prefix

static string extractSlugFromPath(string $path)

Extract the slug without the prefix from a given path.

Parameters

string $path

Return Value

string the slug

static string getPageFilePath(Page $Page)

Return the full file system path of a page's data file.

Parameters

Page $Page

Return Value

string The full file system path

Move a page directory and update all related links.

Parameters

Page $Page
string $destPath
string $prefix
string $slug

Return Value

string the new page path

static string save(Page $Page, string $url, array $data, string $themeTemplate, string $prefix, string $slug)

Save page data.

Parameters

Page $Page
string $url
array $data
string $themeTemplate
string $prefix
string $slug

Return Value

string a redirect URL in case the page was moved or its privacy has changed

static string updateSlug(string $currentTitle, string $newTitle, string $slug)

Update slug in case it is not a custom one and just represents a sanitized version of the title.

Parameters

string $currentTitle
string $newTitle
string $slug

Return Value

string the updated directory name slug

Update all file and page links based on a new path.

Parameters

Page $Page
string $newPath

Return Value

bool true on success

static private string urlByPath(Automad $Automad, string $path)

Return updated page URL based on $path.

Parameters

Automad $Automad
string $path

Return Value

string The page URL