Welcome Guest, Not a member yet? Register   Sign In
Standart for form_input and etc
#1

Hello!

In my opinion, we must have standart for form_input. I want add class form-control to all inputs, I write this code:
PHP Code:
$defaults = [
    
'type'  => $type,
    
'name'  => is_array($data) ? '' $data,
    
'value' => $value,
    
'class' => $data['class'] ?? '',
];
        
if (isset(
$data['class'])) unset($data['class']);
$defaults['class'] .= ' form-control'
If I include more modules in CI4, this design will stop wotking, because all developers uses form_input in his own way.

Now I must write conditions, find class in $data, $extra, if finded $extra, I must write crutch for replace class=" to class="form-control, some will use ', some ",  then somethings more will stop working...
Reply


Messages In This Thread
Standart for form_input and etc - by XTAZ - 12-04-2019, 12:28 PM



Theme © iAndrew 2016 - Forum software by © MyBB