Skip to content

[v5] Assigning a value to a field no longer working #7250

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
pgfactory opened this issue May 28, 2025 · 2 comments
Open

[v5] Assigning a value to a field no longer working #7250

pgfactory opened this issue May 28, 2025 · 2 comments
Milestone

Comments

@pgfactory
Copy link

Description

Assigning a value to a field no longer working, in PHP that is.

Expected behavior
The assigned value should appear when used in a template.

To reproduce

  1. Start from starterkit, paste the code below into template home.php
  2. Open page in browser
  3. See output that says "title: 'Home'" instead of 'XXX'
$page->title()->value = 'XXX';
$value = $page->title()->value();
echo "title: '$value'<br>\n";

$page->title()->value('XXX');
$value = $page->title()->value();
echo "title: '$value'<br>\n";

Two variants, both working in V4. The second variant is the prefered one according to https://getkirby.com/docs/reference/templates/field-methods/value

Your setup

Starterkit with Kirby 5.0.0-rc.2

@bastianallgeier bastianallgeier changed the title Assigning a value to a field no longer working [v5] Assigning a value to a field no longer working May 28, 2025
@bastianallgeier
Copy link
Member

Thanks for creating the issue @pgfactory. We already figured out why it is happening. Now we only need to figure out how to fix it :)

You wrote on Discord that you do this in a plugin. Can you tell us a bit more about what the plugin does and how you use it there?

@pgfactory
Copy link
Author

The plugin is called "PageFactory", which sort of points at its purpose. In short, it prepares a bunch of fields for various elements in a template. The goal was to automate and make re-usable a lot of the standard solutions for problems that pop up in many websites - at least websites of a certain kind. That way, the workflow using PageFactory deviates somewhat from the "standard" one.
It would get out of proportion to explain all the hows and whys at this point. But I'd be happy to do so, should anybody be seriously interested. Actually, I had been pondering about presenting the plugin at one of the meetups. Unfortunately, there hadn't been many south of Frankfurt, yet.
The plugin is "private" as in not officially published. But again, if somebody is interested, I'm (soon) ready to publish it.

@distantnative distantnative added this to the 5.0.0-rc.3 milestone May 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants