Manual and Documentation

NOTE: This manual describes HammerKit version 3.5. To view documentation for the current release of HammerKit Studio, please go to http://manual.hammerkit.com/
search
Index / D. Object API / Classes / HammerKit_Element

A. Introduction
B. Installation and Configuration
C. Using HammerKit tools
D. Object API
Classes
Button
FileUtils
HammerKit_BasicFile
HammerKit_Color
HammerKit_ColorPalette
HammerKit_Component
HammerKit_Converter
HammerKit_CssRule
HammerKit_Db
HammerKit_DbQueryResult
HammerKit_Document
HammerKit_Element
HammerKit_File
HammerKit_GenericObject
HammerKit_Image
HammerKit_Keyword
HammerKit_ObjectCache
HammerKit_ObjectList
HammerKit_Session
HammerKit_Shortcut
HammerKit_Site
HammerKit_System
HammerKit_User
HammerKit_UserGroup
HammerKit_VariableHandler
Style
Interfaces
Object Choosers
Global Variables
Modules
Tools
Converters
Using the API
E. HammerScript
F. Access Rights
HammerKit_Element


NOTE! EXPERIMENTAL. WILL BE IMPLEMENTED IN HammerKit v4

Abstract class

This class describes and contains the functionality of component elements. Elements are the building blocks of components and instances of modules. All modules extend the HammerKit_Element class.

The HammerKit_Element class is an abstract class. Therefore a HammerKit_Element object cannot exist on its own. All HammerKit_Element classes are always extended by a module class.




Attributes

integer:HammerKit_Component component_id
Description: The id number of the component that the element is part of

string class_name
Description: The class name of the module this element is an instance of

string class_root
Description: The path to the module's class file on the server

time creation_time
Description: The time when the element was first created

integer:HammerKit_User creator_id
Description: The id number of the user who first created this element

string description
Description: Description text about the element

unique integer:HammerKit_Element id
Description: The database id number of the element

string[] lang
Description: This array contains the user interface text strings defined in the module's language files. The values of this array are used in the module class' method getSettingsUi where the user interface for the module settings are defined. More about the language files in the section about how to build modules.

time last_modification_time
Description: The time when the settings of the element was last changed

integer:HammerKit_User last_modifier_id
Description: The id number of the user who last changed the settings of this element

string module_author
Description: The value of the module's AUTHOR constant

string module_copyright
Description: The value of the module's COPYRIGHT constant

string module_description
Description: The value returned by the module's getDescription method

string module_max_php_version
Description: The value of the module's MAX_PHP_VERSION constant

string module_max_system_version
Description: The value of the module's MAX_SYSTEM_VERSION constant

string module_min_php_version
Description: The value of the module's MIN_PHP_VERSION constant

string module_min_system_version
Description: The value of the module's MIN_SYSTEM_VERSION constant

string module_name
Description: The value returned by the module's getName method

time module_release_date
Description: The value of the module's RELEASE_DATE constant

string[] module_required_php_extensions
Description: The value of the module's REQUIRED_PHP_EXTENSIONS constant. Note that unlike the constant this attribute is an array of strings.

string module_version
Description: The value of the module's VERSION constant

string name
Description: The name of the element

string operation_pending
Description: This attribute is only used in the content editor where at the component's save time only elements with a value for this attribute are processed. The value can be either 'save' or 'remove'. By default the value of this attribute is an empty string.

integer order_number
Description: The order number of the element in the context cell it appears in

string[] parameters
Description: The parameters from the module settings

string[] parameters_parsed
Description: The parameters from the module settings with all HammerScript expressions expanded

integer:HammerKit_Element parent_id
Description: The id of the parent container element if the element is inside one. The value for this property is 0 if the element is not inside a container element.

integer position_x
Description: The horizontal position of the element if it is inside a container element. The first value is 0.

integer position_y
Description: The vertical position of the element if it is inside a container element. The first value is 0.

string previous_module_version
Description: The version number of the module at the time the element was last saved


Methods

abstract public string exec(void)
Description: All extending classes must implement this method
Returns: The XHTML output of the element

protected final string execSubelements(integer position_x, integer position_y [, integer span_x=0 [, integer span_y=0 [, integer direction='x']]])
Description: Get the output of the elements inside a container cell of the element.
Arguments: position_x is the horizontal address in the container grid, position_y is the vertical address in the container grid, span_x is the cell span in the x-direction and span_y is the span in the y-direction, direction defines the direction in which the spanned cell's content elements are read (either 'x' or 'y')
Returns: The XHTML output of the contained elements

public static final string[string[]] getAttributeList()
Description: Get a list of all class attributes and their properties
Returns: An array where the keys are the attribute names and the values arrays with the properties of the attribute

protected final string getCellId(integer position_x, integer position_y)
Description: Get the DOM document id of a content cell in the element. This is used in the module's getTag method for creating the representation of the element in the component editor.
Returns: The DOM document id. Usually of the form 'HammerKit_ElementCell_[element_id]_[position_x]_[position_y]'

public final HammerKit_Component getComponent(void)
Description: Get the component that the element is part of
Returns: The component object

public final mixed getConstant(string constant_name)
Description: Get the value of a constant of the element's module class
Returns: The value of the constant

public string getDescription(void)
Description: Get the description text of the module
Returns: By default this method returns the description key of the lang attribute array. So if the module author specifies a user interface text in the language files with the key description, then the return value will by default be fetched from there. If the description key is not specified an empty string is returned.

public final string getIcon(void)
Description: Get the icon of the module for the content editor module lists
Returns: The path under the current site URL to the module's icon

public static final HammerKit_ObjectList:HammerKit_Element getList(string[] options)
Description: Get a list of elements by search options
Returns: An object list of elements

public string getName(void)
Description: Get the name of the module for the content editor module lists
Returns: By default this method returns the name key of the lang attribute array. So if the module author specifies a user interface text in the language files with the key name, then the name will by default be fetched from there. If the name key is not specified then the module's class name is returned.

public final string getParameterName(void)
Description: Get the name of the settings parameters array in the module's settings XHTML form.
Returns: A string like "element_parameters"

optional public string[] getSettingsGroups(void)
Description: Get a list of the settings user interface groups of the module. This list is used for tabbing and grouping the settings in the user interface.
Returns: An array with key value pairs where the key is the code name for the settings group used as the argument for getSettingsUi, and value is the language dependent name of the settings group used as the text in for instance in the tab in the user interface.

optional public string getSettingsToolbar(void)
Description:
Returns: This method must return valid XHTML with control elements for manipulating the element directly in the component editor.

abstract public string getSettingsUi([string group])
Description: Get the user interface for the module's settings used in the component editor.
Arguments: The group is the key of a settings group given in the array from the method getSettingsGroups. If the argument is not given then the first group in the settings user interface will be shown.
Returns: A valid XHTML string containing the form elements for setting the element's parameter values.

optional public string getTag(void)
Description: Get the default tag representation for this element in the content editor.
Returns: A valid XHTML string

optional public string getTagInfo(void)
Description: Get the default tag info for this element in the content editor.
Returns: A valid XHTML string

public final boolean remove(void)
Description: Remove the element and all its child elements from the database
Returns: True on success and false otherwise

public final boolean save(void)
Description: Save the element permanently to the database.
Returns: True on success and false otherwise


--- under consideration ---

public final static HammerKit_Element create(string module_class_name, integer:Component component_id)
Description: Create a new element object. The element is not saved into the database until the method save is called on it. Before saving to database the module's id number is 0.
Arguments: module_class is the class name of the module this element will be an instance of, component_id is the id number of the component this element will be part of
Returns: The new HammerKit_Element object

public final boolean placeAt(integer order_number)
Description: Place the element at a position in it's own context
Arguments: order_number is the order number of the element in its context
Returns: True on success and false otherwise

public final boolean placeAfter(integer:HammerKit_Element element_id)
Description: Place the element after another element
Arguments: element_id is the id number of an element the element should be placed after
Returns: True on success and false otherwise

public final boolean placeBefore(integer:HammerKit_Element element_id)
Description: Place the element before another element
Arguments: element_id is the id number of an element the element should be placed before
Returns: True on success and false otherwise

final boolean placeInside(integer:HammerKit_Element element_id, integer position_x, integer position_y)
Description: If the container element_id is specified, then the inside a container element. If the order number is not specified then the element is placed after the last element in the grid cell.
Arguments: element_id is the id number of the container element the element is to be placed into, position_x is the horizontal address in the container grid, position_y is the vertical address in the container grid
Returns: True on success and false otherwise




� HammerKit Oy 2008 UPDATED: 10.02.2009 18:16