Jump to content

Function in field list


The50

Recommended Posts

Hey,

 

Is it possible to apply a function to columns on field list helpers? 

 

As example I have my fields_list like this:

 

       $this->fields_list = [         
             'id_employee' => [
                'title' => $this->l('Employee ID'),
                'type'  => 'int',
            ],
        ];
 
And now I want to apply a function which gets an employee name by it's ID.
Link to comment
Share on other sites

Sorry, already found the solution, just add the 'callback' parameter just like this:

 

          'id_employee' => [
                'title' => $this->l('Creator'),
                'type'  => 'int',
                'callback' => 'getEmployeeNameById',
            ],
 
and put the name of the function which returns the result you want.
  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...