Warning: Invalid argument supplied for foreach() in /concrete/elements/system_errors.php on line 18

Permalink
I'm trying to override the validation markup to use Bootstrap's and so far have:
- Copied error.php to the top level /helpers/validation/error.php
- Updated "class ValidationErrorHelper" to: "class SiteValidationErrorHelper"

The error messages work great on the front end but I get this error when in the c5 dashboard:
Warning: Invalid argument supplied for foreach() in /path/to/site/root/concrete/elements/system_errors.php on line 18


The foreach statement referred to in the dashboard error is this:
<div class="alert-message error">
<?php  foreach($_error as $e): ?>
  <?php  echo $e?><br/>
<?php  endforeach; ?>
</div>


I can see that $e is also called many times in error.php - so does that mean that overriding a helper will cause issues like this?

If I remove my override file, the c5 dashboard is all sweet again.

Here's the markup I changed in error.php (changed the ul to a div and changed the classes to bootstrap alert classes) but I don't really see what would cause the dashboard error sorry:
public function output() {
  if ($this->has()) {
    print '<div class="alert alert-error">';
    foreach($this->getList() as $error) {
      print '<p>' . $error . '</p>';
    }
    print '</div>';
  }
}


Also, can anyone explain how to override the markup c5 generates for forms and validation?

Forms are kinda painful anyway, but Foundation and Bootstrap solve many issues - it's just that controlling how c5 renders form and validation markup so Bootstrap or Foundation works properly is fairly confusing.

Any pointers in the right direction would be much appreciated.

Cheers

Ben

 
cmscss replied on at Permalink Reply
If I just move a fresh copy of error.php to: /helpers/validation/error.php and update the class, I still get the error so am not sure if this is a bug?