Item is the superclass of all the kinds of content held in your PostCMS account. That includes web pages, assets (ie. files) and content types.
| Properties | |
| creationDate | The date the item was created. |
| filename | The item filename. |
| firstPublicationDate | The date the item was first published. |
| language | Two character ISO language code (eg. "en"). |
| modificationDate | The date the item was last modified. |
| name | The name of the item. |
| owner | The name of the person who owns the item (usually, the person who created it). |
| path | The path of the item, relative to the site root. For example: "images/logo.png" |
| publicationDate | The date the item was last published. |
| section | The full name of the section where the item is located. For example "Topics/Current events/Europe". |
| state | The item's current state, eg. "In progress". The possible values depends on the item's workflow. |
| subtype | If the item is a page, this will be its template name. If it is an asset, it will be the asset type name (eg. "PDF"). |
| tags | Array of tags attached to the item. |
| type | The type of the item. One of "page", "asset" or a content type name. |
| Methods | |
| Item.exists(path) | Check whether an item exists. Returns true or false. |
| Item.get(path) | Static method to retrieve an item that already exists. |
| lock() | Take a lock on an item, preventing other users from updating it. |
makeFilename(name, ext)
| Build a valid/safe filename from the supplied name and extension. For example, Item.makeFilename("Here's a name", "php") would return "here-s-a-name.php". |
| publish([date, [units, nUnits]]) | Publish/schedule this page or asset. With no parameters the item is published immediately. With one (date) parameter, the item is scheduled for publication on that date. With 3 parameters, the item is scheduled for publication on dateand is also scheduled to repeat according to units and nUnits. "unit" can be "day", "month", "week", "hour", "minute". "nUnits" is a number that specifies how many of these units should pass before republication. |
| rename(newName) | Rename an item, keeping it in the same section. |
| unlock() | Unlock an item. |