Page.php

<?php
/**
 * Defines the ArticlePage page type
 */
class xxxP extends Page {
   static $db = array(
   );
   static $has_one = array(
   );
}
 
class xxx_Controller extends Page_Controller {
 
}
 
?>

Control behaviour: They say:

 static fields we can define to change the properties of a page type. The $allowed_children field is an array of page types that are allowed to be children of the page in the site tree.

static string $add_action
static array $allowed_children
static mixed $belongs_many_many
static string $breadcrumbs_delimiter
static bool $can_be_root
static boolean $can_create
static mixed $casting
static int $currentPageID
static array $currentSectionIDs
static mixed $db
static mixed $defaults
static string $default_child
static string $default_parent
static mixed $default_sort
static mixed $extensions
static mixed $has_many
static mixed $has_one
static string $hide_ancestor
static string|array $icon
static mixed $indexes
static mixed $many_many
static array $need_permission
static mixed $versioning

Add additional fields to the static $db thingy.  Note that names must be unique: The names chosen for the fields you add must not already be used across the entire cms!

Add fields to xxx.php to getinto the db (need to do the rebuild thingy)

static $db = array(
   'Date' => 'Date',
   'Author' => 'Text'
);

To be able to update these fields in the CMS editor we need to override getCMSFields() with our own in xxx.php:

function getCMSFields() {
   $fields = parent::getCMSFields();
 
   $fields->addFieldToTab('Root.Content.Main', new CalendarDateField('Date'), 'Content');
   $fields->addFieldToTab('Root.Content.Main', new TextField('Author'), 'Content');
     
   return $fields;

They say:

$fields = parent::getCMSFields();

Firstly, we get the fields from the parent class; we want to add fields, not replace them. The $fields variable returned is a FieldSet object.

 $fields->addFieldToTab('Root.Content.Main', new CalendarDateField('Date'), 'Content');
 $fields->addFieldToTab('Root.Content.Main', new TextField('Author'), 'Content');

We can then add our new fields with addFieldToTab. The first argument is the tab on which we want to add the field to: “Root.Content.Main” is the tab which the content editor is on. The second argument is the field to add - this is not a database field, but a FormField. We must create new form fields, passing them the name of the database field we wish to edit. See the FormField documentation for all the field types available. The last argument says that we wish to put our fields above the “Content” field, see the FieldSet documentation for more details.

return $fields;

Finally, we return the fields to the CMS. If we flush the cache (?flush=1), we will be able to edit the fields in the CMS.