What's an Attribute?

An attribute is some data you want to store. The simplest would be a short text field. Just about anything you'd see on a form on the web could be an attribute as well, and most of them are already created as standard types available in your basic concrete5 install:

  • Text - a short text string.
  • Text Area - a longer field you might use for "Comments:" in a form. 
  • Checkbox - A true/false or on/off setting. 
  • Date/Time - Pick a day from a nice javascript calender, choose the time too. 
  • Image/File - attach a file to something. 
  • Number - force the input to be an integer.
  • Rating - 0-5 stars on something. 
  • Select - Pick one, or pick many. 
  • Address - Pre-populated with countries that update state/provice lists, all the fields you need to store and address. 

Attributes differ from blocks in that they are primarily NOT meant to be displayed to the end user. They are meant to be used by programmers, addon and theme developers to store, search, and manipulate data of different types. By contrast, blocks apply just to pages, are primarily front-end focused.

Where can I use them?

These attributes can be assigned to pages, user records, files in the file systems, products in the ecommerce system if you've installed it, etc. Add-on developers can create their own attribute types or take advantage of existing ones without having to recreate the wheel over and over. Click here to get a complete list of attributes as they're currently used in concrete5 core.

Attributes vs. Attribute Types

An attribute type is a way of classifying an attribute. "Checkbox" is a type of attribute. When an attribute is created for a specific use, you choose an attribute type and give it a name. So a page might have a dozen or more attributes of the checkbox type to determine different settings/options like "exclude_from_search" or "feature_on_homepage."

Attribute Categories

An attribute category is the type of object that attribute applies to. By default, the attribute categories in concrete5 are page, file, and user. Additional addons might create new categories (e.g. the eCommerce addon adds product and order as additional attribute categories.) Experienced developers can create these categories, but should only do so when they absolutely must as they involve database changes that can impact performance. 

To learn more about making your own attributes, follow Andrew as he makes a custom attribute based on the address type


Recent Discussions on this Topic

Image Attribute for user

Hi It seems like it is not possible to add an image/file attribute to users? Thanks Alexander

error message

hello, any idea why I receive this error message when using the superfish menu http://www.awtndatastorage.com/skitch2//4Sprung_web_development____Home-20100421-163333.png

Built-in Address attribute?

The documentation at http://www.concrete5.org/documentation/general-topics/attributes/ references an "Address" attribute type: "Address - Pre-populated with countries that update state/provice lists, all the fields you need to store and address." B…