public function updateViewView($view_path, $element)
{
$data = file_get_contents($view_path);
if (preg_match('/<tbody.*<\\/tbody>/si', $data, $m)) {
$lines = explode(chr(10), $m[0]);
$open_tbody = array_shift($lines);
$close_tbody = array_pop($lines);
$replace = $open_tbody . "\n";
foreach ($lines as $line) {
if (trim($line)) {
$replace .= $line . "\n";
}
}
foreach ($element['fields'] as $field) {
$replace .= "\t\t" . $this->getHTMLField($field, 'view') . "\n";
}
$replace .= $close_tbody . "\n";
file_put_contents($view_path, str_replace($m[0], $replace, $data));
}
}