It is possible to define custom icons and styles for objects in the object tree.
In order to do so, overwrite the method getElementAdminStyle of Object_Abstract by using the class mapping functionality (Extending pimcore) and return your own implementation of Element_AdminStyle.
Possible properties to define:
- Element css class
- Element icon
- element icon class
Extend the object class and overwrite the getElementAdminStyle:
public function getElementAdminStyle() { if (!$this->o_elementAdminStyle) { $this->o_elementAdminStyle = new Website_OnlineShop_AdminStyle($this); } return $this->o_elementAdminStyle; }
Custom Implementation of Element_AdminStyle
class Website_OnlineShop_AdminStyle extends Element_AdminStyle { public function __construct($element) { parent::__construct($element); if($element instanceof Website_OnlineShop_Product) { if($element->getProductType() == "concrete") { $this->elementIcon = '/pimcore/static/img/icon/tag_green.png'; $this->elementIconClass = null; } else if($element->getProductType() == "family") { $this->elementIcon = '/pimcore/static/img/icon/tag_yellow.png'; $this->elementIconClass = null; } else if($element->getProductType() == "virtual") { $this->elementIcon = '/pimcore/static/img/icon/tag_blue.png'; $this->elementIconClass = null; } } } }
Example result
