XF 2.2 How to call back own custom fields

FoxSecrets

Active member
I'm trying to use custom fields in my add-on and i've implemented the class successfully, however I don't know how to call back the fields. I'd like to understand better this functionality.

Basically I've got the fields created under the display group "my-addon" (added by me) and recorded in the table "my_addon_custom_fields".

I took a look at the "contact" implementation, tried changing the "arg-group" to "my-addon" but didn't work.

How can I call back my own custom fields?

Code:
                  <xf:contentcheck>
                    <xf:macro template="custom_fields_macros" name="custom_fields_edit" arg-type="users" arg-group="contact" arg-set="{$xf.visitor.Profile.custom_fields}" />
                  </xf:contentcheck>
 
Last edited:
I don't understand what you are trying to do.
To make a callback i do:

Add a custom field
Check the form fields for a callback.
Insert add-on*/function*?

Add a new add-on with name add-on*
This add-on has one file with a function function*

I use this for telephone numbers with some regex.

Form > send > value of the custom field is sent to callback function > callback function returns a value > go on with form actions
 
Check radio: PHP-Callback

Example

Robert9\Callbacks\CustomFields :: repairMobil

All of my callbacks for custom fields are in this add-on:



PHP:
<?php
namespace Robert9\Callbacks;

class CustomFields
{

    public static function repairMobil($definition, &$value, &$error)
    {

        $value = preg_replace('/--/', '-', $value);

        {more code}

        return $value;
    }

{more functions}
 
Back
Top Bottom