This feature was started in Tiki5 and will be more & more used in Tiki6
Attributes should be used to create cross-feature functionality.
Attributes
To implement transversal features such as geolocalization of objects in tiki, Object Attributes were introduced. Not unlike user preferences, they are key-value pairs stored in the database and are associated to the type and itemId (same as object permissions).
To avoid the inconsistencies seen in the preference naming conventions, the attribute library enforces a few conventions.
- Attribute names may only contain lowercase letters and dots.
- Two levels of scoping are required. First level for bundled attributes must be tiki. Custom extensions can use an other prefix. Second level must be some sort of package name. The rest is up to the implementor.
Valid attributes would be tiki.geo.lat or tiki.geo.lon
Library code is located in lib/attributes/attributelib.php. The library allows to:
- Get all attributes for an object as a map using get_attributes().
- Set a single attribute on an object using set_attribute().
Because all values are fetched at once, the length of the content must remain small. The limit of the size of attribute and relation names is 25 characters.
Current attribute usage in the tiki.* namespace
Please document namespace use here as you start using new attributes in Tiki features
Attribute | Usage | |
tiki.article.* | Custom attribute fields for articles | Not appropriate! Attributes should be applicable to all object types |
tiki.comment.ranges | Range information for annotatorjs for inline comments (since 17) | |
tiki.content.url | File gallery files location of remote content | |
tiki.content.expires | File gallery files expiration of remote content | |
tiki.content.lastcheck | File gallery files last check time of remote content | |
tiki.content.source | Same as tiki.content.url if not a "reference"? | |
tiki.content.etag | File gallery files etag of remote content | |
tiki.geo.lat | Latitude coordinate of the object | |
tiki.geo.lon | Longitude coordinate of the object | |
tiki.geo.google.zoom | Zoom level of an object used in Google Maps | |
tiki.icon.src | Icon url for object such as trackeritems | |
tiki.object.lock | Username of who locked the object (since 15) | |
tiki.object.image | Used in forums? | |
tiki.object.layout | Page layout to be used (used in wiki pages) | |
tiki.proposal.accept | Proposal plugin +1 vote | |
tiki.proposal.undecided | Proposal plugin 0 vote | |
tiki.proposal.reject | Proposal plugin -1 vote | |
*.rating.override | Ratings? | |
tiki.relation.target | Label to be used when referring to the target of a relation | |
tiki.relation.source | Label to be used when referring to the source of a relation | |
tiki.sync.provider | Remote tracker sync providor | |
tiki.sync.source | Remote tracker sync source | |
tiki.sync.last | Remote tracker sync last sync time | |
tiki.tracker.pretty.views | Invalid and probably unused (from r34097) | |
tiki.wiki.autotoc | Override the global pref for autotoc per wiki page | |
tiki.wiki.page_hide_title | Override the global pref for show title per wiki page | |
tiki.wiki.namespace | Namespace of a wiki page |
Relations
The Object Relations allow to qualify a relationship between any two objects in the system or with external resources (URLs). Just like attributes, the qualified name of the relationship must be scoped.
Relations are managed with lib/attributes/relationlib.php.
Because all values are fetched at once, the length of the content must remain small. The limit of the size of attribute and relation names is 25 characters.
Current relation usage in the tiki.* namespace
Please document any relations used in Tiki features here
Relation | Usage | |
tiki.article.attribute | Relationship between an article type and its related custom attribute fields | |
tiki.article.attach | Used in the Articles tracker field to attach articles to a tracker item | |
tiki.file.attach | Attaches File Gallery files to objects (tracker items so far?) | |
tiki.friend.follow | used by the friends feature to indicate a friendship/following relationship | |
tiki.friend.request | used by the friends feature to indicate a request to be friends | |
tiki.general.related | Any generic relationship not specific to any feature/module | |
tiki.link.$type | Links wiki pages ($types are probably semantic etc) | |
tiki.mustread.complete | Used by the Must Reads feature to indicate that a Must Read is complete | |
tiki.mustread.required | Used by the Must Reads feature to indicate that a Must Read is required by a user | |
tiki.mustread.comment | Used by the Must Reads feature to indicate that a Must Read is requires a comment by a user | |
tiki.mustread.respond_privately | Used by the Must Reads feature to indicate that a Must Read needs a private reply by a user | |
tiki.mustread.circulation | Used by the Must Reads feature to indicate that a Must Read requires a user to circulate it | |
tiki.social.like | used by PluginLike for liking of objects | |
tiki.source.creator | used by PluginInsert to keep track of which page created the Tracker Item via this plugin | |
tiki.sheet.$type | Relates sheets and trackers | |
tiki.user.favorite | Links users to favourite objects (wiki pages only so far?) | |
tiki.user.banned | To ban users from objedcts (groups initially for 8.x could be extended) | |
tiki.wiki.linkeditem | used by the Wiki tracker field type to link a wiki page with a tracker | |
tiki.wiki.linkedfield | used by the Wiki tracker field type to link a wiki page with a tracker |
Displaying links to relations using the object_link smarty tag
A smarty tag like this will show a link to the object that is at the target end of the relation. The text of the link will be the "tiki.relation.target" attribute set for that relation (i.e. the attribute for an object of type 'relation' and relationId, if any. If there is no such attribute set for that relation, then it will show the usual link as per the normal behavior of the object_link tag.
{object_link type=relation_target id=x}