• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
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


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.