Modify a custom page header field

Is there a simply way to modify a custom page header field, something as simple as

$a_specific_page_markdown->set('header.custom_field') = $updated_value;

or even better with twig:

{% a_specific_page.header.custom_field = updated_value %}

I’ve looked into the admin preparePage() function but I’m not skilled enough to use it for my purpose (and it updates the whole page, I just need to update a specific custom page header)

the first php line has no sense, but I hope you got the point :slight_smile:

What are you trying to accomplish generally?

I have a collection of pages representing an item reference. I’d like to put a quantity custom field in the header and be able to update it from an admin page that lists all the items (pages) and let the user to modify the quantity.

Any idea? Or any plugin to point me out where I can get inspiration?

May I suggest an idea: do not put the quantity custom field in the header but save them in a data file.

Since each page has a slug, you may take inspiration from Star Ratings plugin. This plugin allows users to choose how much pleasure give to a post and records it in two files in the /user/data/star-ratings/
ips.json includes users IP, stars.json contains routes and satisfaction.

Users increase the amount that can be managed in admin

You can’t highlight section header in std page layout. To change look and feel of page layout section use VF page.