Simple data attributes
The framework features a global attribute collection which is useful for storing data in a key/value format. This is mostly used for storing settings, which are small pieces of data. The entire collection of attributes are loaded on every post back, so it should not be used for hugh amounts of data.
The following example demonstrates how to add data to the attribute collection, as well as reading values.
|// Save value
// Get value
$value = SMAttributes::GetAttribute("MyKey");
Notice that data added to the collection is committed between the life cycle events Unload and Finalize. To ensure important data, Commit may be invoked on the object.
The following table describes the functionality of the global attribute collection in greater details.
||Set the value of the specified attribute. If attribute does not exist, it will be created. If attribute exists, it will be updated. The key must be a unique key - prefix with the name of the extension in which the attribute collection is used, to avoid overwriting attributes created by other extensions.
||Remove attribute with the specified key. Returns True if attribute is found and removed, otherwise False.
||Returns True if given attribute exists, otherwise False.
||Get value of attribute with the given key. Will return null if attribute is not found.
||Commit attribute collection. This function is automatically invoked between Unload and Finalize in the life cycle.
||Will return True if changes has been made to attributes, otherwise False.