This is a result of a larger problem / discussion, but, I need to access some fields on a page from an array of “problem fields”, using a hook.
I suppose it’s more of a general PHP question, but, how do I make this work?
kirby()->hook('panel.page.update', function($page) {
$problem_fields = array('text', 'feild_two', 'feild_three');
foreach ($problem_fields as $field) {
if (isset($page->{$field}) {
$text = strip_tags($page->{$field});
$page->update(array($field => $text));
}
}
}