Developer guide     >     Developing Extensions     >     Properties

Object properties

yeager allows adding custom properties to Pages, Files, Content Blocks, E-Mailings and Users. These properties (if not explicitly hidden) are displayed to Users when accessing the properties tab of an object.
 
The administration of visible, custom object properties is possible through yeager's System settings administration panel. 

Configuring properties

Object managers which allow the customization of the objects properties offer a class member ->properties which is an instance of the PropertySettings class (see API docs: PropertySettings).
  1. // gets a list of custom Content Block properties
  2. $propertylist = sCblockMgr()->properties->getList();
  3.  
  4. // adds a custom property (visible to Users)
  5. sCblockMgr()->properties->add("title on properties tab", "IDENTIFIER", "CHECKBOX");
  6.  
  7. // adds a custom property (invisible to the Users)
  8. sCblockMgr()->properties->add("non visible title", "IDENTIFIER2", "TEXT", 0);

Accessing properties

Accessing an object's properties is possible by instancing an object. The object includes a class member ->properties which is an instance of the Properties class (see API docs: Properties).
  1. // instances the Content Block with the Id 12;
  2. $cblock = sCblockMgr()->getCblock(12);
  3.  
  4. // gets a list of all properties of that Content Block including values
  5. $allvalues = $cblock->properties->get();
  6.  
  7. // gets only the value of one specific property
  8. $onevalue = $cblock->properties->getValue("PROPERTYIDENTIFIER");
  9.  
  10. // sets the value of one specific property
  11. $cblock->properties->setValue("PROPERTYIDENTIFIER", "new value");
  12.  

Property type

Properties (when not explicitly hidden) end up as editable form elements displayed to the User in yeager's UI. The type of the form element (single-or multi-line textfield, checkboxes, etc.) is defined when the Property gets added. A full list of Property types is available here: