Welcome Guest, Not a member yet? Register   Sign In
Can not use localization on form validation rules

We have a set of rules like below:

PHP Code:
public $rules = array(
'email' => array(
'field' => 'email',
'label' => 'Email',
'rules' => 'trim|valid_email|required'

where we would like to replace the 'label' => 'Email' with $this->lang->line('user_email')

However it produces the following error:

Message: Constant expression contains invalid operations

Are we doing something wrong?

You can't use variables inside class variables. You will need to assign $rules, from within your __construct().

Theme © iAndrew 2016 - Forum software by © MyBB