public $form = array (
array(
'field' => 'email',
'params' => array(
array(
'rule' => 'email',
'on' => 'create',
'required' => true,
'error' => 'The email is invalid!'
),
array(
'rule' => 'email',
'on' => 'update',
'required' => false,
'error' => 'The email is invalid!'
)
)
)
);
public function onlyNeeded($action) {
$form = $this->form;
$action = $this->action;
foreach ($form as $formelement) {
$field = $formelement['field'];
$paramsgroup = $formelement['params'];
if ($paramsgroup['on'] != $action) {
form = removeparamsgroup($form, $action);
}
}
return $form;
}
How do I do the removeparamsgroup()
function?
There are [index]es, not only [name]s!
Do you know what I mean?
array(array( twice!