Pubkit Classes

PubKit uses PHP classes to keep specific features of item types together and simplify the core creating/updating loop.There are two base classes, Resource and Record.

Resource is the default class, and uses the existing Document class by ur001 to create, retrieve, update and delete MODX resources (documents).

The Record class contains general functions for these operations using database tables. PubKit does not include any means to create the custom tables. You need to use a MODx module, phpMyAdmin or equivalent facilities to do that.

Both base classes provide shared initialization and data verification functions for the various item types.

The item types, such as Post, Event and the sample Player class, extend the base classes. In addition to the properties and methods of the base classes, they can declare their own properties and methods as required, including specialized initialization and save operations, either replacing or adding to the parent class's properties and methods.

All of the PubKit snippet call's parameters are supplied to the class as an array called params within the fields array. (See Record class for example of this)

Standard tasks for a class are: