Developers > Kernel Documentation > Content Management > : manage content objects

A content object is an element of a web page, such as text, html, stylesheets, scripts, images, or downloadable files. This module provides methods to act on generic content objects.

This is part of the ExSite content stack, so it inherits from the ContentData (and then ContentBase) class, and is in turn inherited by Page.

Configuration & Setup


(This method is actually inherited from ExSite::ContentBase.)



Instantiate and/or configure a content object. %option includes the the configuration parameters, described below.


    my $content = new ExSite::Content(%option);

setup and setupContent are synonymous; they are used to setup or reconfigure an existing Content object. new() instantiates a new content object (this method is actually inherited from ExSite::ContentBase).

%option is used to pass the content description information that allows the object to be configured. It can include the following content description parameters:

The numeric content ID will be used to fetch the content description from the database.

The content record can be passed as a hash reference, if it has already been fetched.

page, name
Given a page ID and content object name, the content can be looked up in the database.

If no content description is provided, the object will configure an empty content object that will have limited functionality.

The setup methods are normally invoked automatically by the class constructor method new(), which receives the same %option parameters.



Returns the content/authorization type, ie. ``editorial'' or ``design'', which determines who is allowed to update the content.


Returns TRUE if the current user is permitted to update the content. This depends on the the user's access level, and their admin key for the current section, which determines their access privileges.

Content Management


This creates a new revision of the content; it is synonymous with ExSite::ContentData::make_content_data().


This removes the most recent revision of the content.


Returns the number of revisions on file for this content.

Creating/Modifying Content Objects

NB: modifying means changing the content attributes, not updating the content. The latter operation is done by calling the update() method.


    my @errors = $content->validate($data);
if (@errors == 0) { # content is OK }

Returns TRUE if the values in the the $data hashref comprise a valid and legal content description. Returns an array of error messages, which will be empty if the content validates.




Creates a new content object, with the attributes given in the $data hashref. If the user is permitted to create new content objects and the attributes validate, then the content record will be created.

If $revision is defined, then a ContentData object will be created as well, using the content_data description in $revision, and any extra options in $opt. These are passed to ExSite::ContentData::make_content_data().


Removes the content object from the system. Attempts to unpublish its files, as well.