webCOMAND

Content Type Methods

COMAND recognizes a number of methods by their name and calls them automatically to accomplish certain tasks.  In many cases a method is called in response to content modifications.  A content type method can be defined in one of the following ways (only the first match will be used).

  • Content Type Template - If a content type template is defined with the same (case-insensitive) name as one of the methods below, it will be used.
  • Content Type Model - If a public method is defined with the same (case-insensitive) name as one of the methods below, preceded by method__ ("method" followed by two underscore characters), it will be used.  For example, method__Validate().

For example, if a Content Type Template named "Summary" or Content Type Model Method named "method__Summary()" is defined, it will be called and its return value will be used whenever the object is referenced as a string.

The following methods are recognized and may be used to modify default behavior.

  • New - Called just after an object is created with its default values (by the repository new_object method), to initialize fields to default values and otherwise prepare for the new object. If one or more errors are logged to the event log, the new process will be cancelled and fail.
  • Summary - When an object is referenced as a string, it will automatically produce a string representation of the object based on the content type. The Summary method can override COMAND's default rules. For details, see Object Summary.
  • Description - Called when an object is updated to produce and cache a brief description, which is included in list view, etc.
  • Icon - Called when an object is updated to produce and cache an image blob to represent the object.
  • Key - Every object is assigned a string that uniquely identifies it from all other objects of the same content type. Ideally, it is a human-readable string. The UniqueIdentifier method can override COMAND's default method. For more information, see object class Key.
  • Keywords - Called when an object is updated to produce and cache a set of keywords that can be searched in webCOMAND and with the API Search Framework.
  • Validate - Called just before an object is approved or saved to validate field values and potentially perform additional tasks to prepare to approve/save the object.  If one or more errors are logged to the event log, the approve/save process will be cancelled and fail.  If the Validate method returns false, the validation process will end without proceeding to field validations.
  • Image - Called to produce the binary image file data from content that can be inserted into a rich text field.  Content can be inserted into a rich text field if the ImageHTML content type method (see next) is defined for the content's content type.  For more information, see Rich Text Editor Customization.
  • ImageHTML - Called to produce the HTML image tag for a content type that can be inserted as an image into a rich text field.  For more information, see Rich Text Editor Customization.
  • Save - Called immediately after an object is saved.
  • Store - Called immediately after an object is stored.
  • Submit - Called after the more specific Approve, Save or Store content type method is called, for all cases.  This is useful because it is always called no matter how an object is updated.
  • Approve - Called immediately after an object is approved.
  • Copy - Called just after an object is copied, to update fields and otherwise prepare for the operation. If one or more errors are logged to the event log, the process will be cancelled and fail.
  • Delete - Called just before an object is deleted, to prepare for the operation. If one or more errors are logged to the event log, the process will be cancelled and fail. If a value is returned, the operation will be cancelled, but not fail. A return value can be useful when an object should be moved or modified instead of getting deleted.
  • Move - Called just after an object is moved, to update fields and otherwise prepare for the operation. If one or more errors are logged to the event log, the process will be cancelled and fail.