New Page API

Last modified by Vincent Massol on 2021/04/06

10.6 brings the Page concept which was introduced in 7.4 to the API and the macros.

PAGE EntityType and Page*Reference classes

First thing first we now have a few new types in EntityType and the corresponding typed Page*Reference helpers. One for each of the element you can have in a page:

  • PAGE
  • PAGE_ATTACHMENT
  • PAGE_OBJECT
  • PAGE_OBJECT_PROPERTY
  • PAGE_CLASS_PROPERTY

Corresponding resolvers/serializer/providers

Each of the already existing DOCUMENT oriented resolvers and serializers have their PAGE oriented implementation.

Conversion from DOCUMENT to PAGE world

The entity resolvers automatically convert from/to DOCUMENT from/to PAGE world references. So yes, using a resolver is the official way to do that conversion.

New syntax

Pages reference have a very different syntax.

To summarize it's a filesystem path syntax with support for parameters.

Here is are a few examples:

wiki:page1/page2;param1=value1;param2=value2;en_US

wiki:page1/page2/attachment

../siblingpage
  • separator: "/" between all elements except WIKI which is still ":"
  • escaping: still "\"
  • current, parent support: like in a file system you can refer to the current page or parent page/wiki using "." and ".."
  • parameters: we now have syntax to express the parameters of an EntityReference. Each parameter is separated by a ";" at the end of the entity name
  • default parameter: the syntax have the concept of default parameter which mean a parameter for which you don't need to indicate the name. For example PAGE reference default parameter is "locale"

New resource reference

A new resource reference of type PAGE has been added and can be used in links for example:

[[parent>>page:..]]
[[page:page1/page2]]

Miscellaneous

  • the $services.model API also got his own new helpers to manipulate pages
  • support for page references have been added to various oldcore (XWiki/XWikiDocument/Document) and bridge (DocumentAccessBridge) APIs
  • support for page references have been added to the security module
Tags:
   

Get Connected