Entry Attributes

From EIRMA Wiki

Jump to: navigation, search
Quick Links

Overview and Tutorial


Pre-Installation

Installation

Post-Installation


Administration


Moderation


Design


Advanced


Other

Contents


LDM allows you to define new attributes in addition to the standard attributes (name, url, etc) used for entries. These can be used to provide additional text and image fields; additional urls, files, media; etc. The attributes are organised into groups, which are displayed within the entry listing. They can be searched by users and accessed programmatically within LDM. Any reasonable number of additional attributes can be defined. You can control which attributes are available and seen by users on a per-category basis.

The possibility to add new attributes was included in version 2.2.9 of LDM and extended substantially in version 2.3.0.

Standard Attributes

All entries in an LDM database have the following standard attributes:

  • A name
  • A URL pointing to the link or file
  • A description
  • An associated image
  • Associated forum, if any
  • A record of 'hits'

as well as a set of internal pointers to parent category/categories, assigned keywords, user comments and ratings, 'user favourite' flags, and so on.

You do not need to take any action to make the standard attributes available. However, you can hide some by using the controls on the LDM->Admin->Settings page.

Specifying New Attributes

New attributes and attribute groups are defined using LDM->Admin->Entry Attributes. Each attribute has:

  • a name, for example "Track Length"
  • a type, see below
  • a description,
  • a group, for example "ID3tags", and
  • a display order

An attribute group has

  • a name,
  • a display order,
  • a 'hidden' flag, and
  • a 'display collapsed' flag

Some of the group settings can be modified on a per-category basis, using the Edit Category form.

Admin Attributes page

Each attribute and attribute group must be given a unique name. This name can begin with *, in which case, when LDM displays an entry that uses this attribute/attribute group, the name will be replaced with the equivalent phrase in the user's current language, e.g. the name of attribute called *ID3tags will displayed using the contents of the phrase ID3tags.

Attribute Types

The attribute type controls how the value behaves and is displayed, and how values are supplied on the data entry form. There are nine available attribute types:

  • Text. Can include smilies, bbcodes, etc, which will be processed according to current LDM settings
  • Url. Accesses are recorded in the hits table in the usual way. The actual url will be hidden from users or revealed according to the current setting of force_redirect
  • Upload. As a url, but provided as a file upload
  • Media url. As a url, but must point to a file that is playable by one of the active LDM media players
  • Media upload. As an upload, but must be playable by one of the active LDM media players
  • Image url. Checked to ensure that url points to a valid image
  • Image upload. Checked to ensure that file is a valid image
  • Yes/no
  • Hidden. Typically used by LDM itself or by LDM add-ons. Hidden attributes are handled in the same way as text attributes but the contents are only visible to users with both can_view_hidden and can_view_entities permissions

Assigning Attributes to Entries

Add Entry Attribute Fields

Attributes are given values and associated with entries using an entry's Add/Edit Entry form. Users with can_edit_entities permission see an extended Add/Entry form, with form fields for each of the available attributes.

Check the required Set Value check boxes to open up the value form field, and supply the required values. These attribute values are then associated with the entry. Repeat the process as required for other entries.

Warning: It is not currently possible to add attributes when LDM->Admin->Setting allow_add_multi is set to a value greater than 1, i.e. when you allow users to add more than one entry in one go. The attribute fields only appear on the Add (Single) Entry and Edit Entry forms.

(It is possible to automate the process of defining attribute values using plugin extras, which would normally be attached to the ldm_addlink_preinsert hook. The id3tag-enhancements extra supplied with LDM shows how to include an mp3 file's ID3 tags as part of its entry. This extra was used to prepare the example illustrated here.)

Controlling Attribute Visibility

Each entrybit will normally display all attributes that have a value assocated with that entry. The attribute group's settings control whether and in what order these values will appear.

Category Attribute Fields

For example, if the group's 'hidden' flag is set, none of the group's contents will be displayed in the entrybit, nor available for data entry on the Add/Edit Entry forms.

If an attribute group has a display order set to zero or less, the group will only be visible to users with can_view_hidden permission.

Similarly, if an individual attribute has a display order set to zero or less or a hidden attribute type, that attribute will only be visible to users with can_view_hidden permission.

If the attribute group's 'display collapsed' flag is set, the group will appear as a collapsed table in the Add/Edit Entry forms.

Controlling Visibility in Different Categories

Since display orders and 'hidden' flags can be modified on a per-category basis using the relevant Edit Category form (inherited by child categories in the usual way), it is possible to change the visibility and presentation of attributes and attribute groups among categories. Only those groups that have their hidden flag unset and the groups and attributes that have positive display orders in the current category are made available for data entry and are displayed.

In order to change attribute's display orders and hidden flags using the Edit Category form, the user must have can_edit_category and can_set_display_order permissions.

Displaying Attributes in Entrybits

Entry attributes will only appear in the entrybit when their display has been switched on globally or on a per-category basis in order for them to appear, and when the user has the necessary permission:

  • Enable display_entities globally using LDM->Admin->Settings or in the current category, and
  • Give the required usergroups can_view_entities
Entry Attributes displayed in linkbit. All attributes are of type 'text'

If these conditions are met, the entry's visible attributes will appear as illustrated:

  • Text attributes include a hyperlink to an automatic search, which finds all entries with atrributes that match the words in the current attribute
  • Urls are displayed as managed links
  • Image attributes are displayed as thumbnails
  • Media files are displayed as links that launch the Jukebox

The standard template places each attribute inside a small table. Display characteristitcs including table width, spacing, image size and entries per row are controlled via the LDM->admin->Settings and Add/Edit Category pages.

Searching Attributes

The Advanced Search form provides the means to search for given words or strings in attributes. These searches examine the content of text attributes (and also hidden attributes if the user has can_view_hidden permission), as well as the content of all attribute descriptions.

Personal tools