UserFieldHelper
Description and methods
Class contains handler methods for events from user field API. Singleton.
Methods
Method | Description | Available from version |
---|---|---|
public static function getInstance(): UserFieldHelper | Returns class instance. | |
public function getManager(): ?\CUserTypeManager | ||
public function getApplication(): ?\CAllMain | Getters to avoid writing global in code of other methods. | |
public function parseUserFieldEntityId(string $entityId): ?array | Attempts to get a factory instance and type ID from string ID of user field entity. When attempt is successful (factory was registered correctly), the result will contain array with factory as first item and factory type as second item. |
Event handlers
Method | Description | Available from version |
---|---|---|
public static function OnBeforeUserTypeAdd($field) | Before creating new field. Attempts to define if registered factory exist for this field entity. When such factory exists, user field API will not create own tables. | |
public static function onAfterUserTypeAdd($field) | After creating new user file this method adds new column to item's table. When required, method creates table for saving multiple values | |
public static function OnBeforeUserTypeDelete($field) | Method removes data before deleting a field:
| |
public static function onGetUserFieldValues(Event $event): EventResult | Doesn't allow querying user fields own tables for searching values. Collects values from its own table and returns them. | |
public static function onUpdateUserFieldValues(Event $event): EventResult | Doesn't allow querying user fields own tables for updating the values. Defines ORM data manager to be used and updates values using it. | |
public static function onDeleteUserFieldValues(Event $event): EventResult | Doesn't allow querying user fields own tables for deleting the values. Defines ORM data manager to be used and deletes values using it. |
© «Bitrix24», 2001-2024