You will rarely need to interact directly with the AttributeCategory class; it is only really necessary when you're adding attribute functionality to your own object.
Attribute Category Examples
concrete5 ships with three attribute categories
- File
- User
- Collection
Creating Your Own Attribute Category
If you to bind attributes to your own objects, you'll need to create an attribute category for those objects.
Add to the Database
Let's say you have a custom object, named Widget, that you'd like to add an attribute category for. You must run
$allowSets = false; AttributeKeyCategory::add('widget', $allowSets, $pkg);
($pkg is only necessary if your attribute category is being added to a package.)
Once this is done, you will have created an Attribute Key Category for your object, which will allow you to create AttributeKey objects against. Now you need to create the class that extends the AttributeKey and AttributeValue objects. You can learn about this in the next section.