Ok this is a long shot, but here goes.
I am trying to modify the translated layout plugin from Daandelange.
The plugin extends the LayoutField class:
class TranslatedLayoutField extends LayoutField {...
$this
in this context refers to a “field object”:
TranslatedLayoutField
layouts:
0 =>
0 => '1/1'
1 =>
0 => '1/2'
1 => '1/2'
settings: null
blocks: null
fieldsets:
field: null...
I need to hook into page.update.after and call a function of the TranslatedLayoutField class, the function requires the “field object” as the second argument, but I don’t know how to access the same “field object” in the context of a hook.
'page.update:after' => function (Kirby\Cms\Page $newPage) {
$layout = $newPage->content('en')->layout()->value();
$field = $newPage->blueprint()->field('layout'); <---- HOW TO CALL FIELD OBJECT??
$newLayout = TranslatedLayoutField::setTranslatedLayout($layout, $field, $newPage);
}
Some of my terminology is probably wrong, I don’t know if it’s called a “field object”…
Thanks