hi,
drupal 11.3.3
php 8.3.6

It does not change the existing value and no error is shown.

CommentFileSizeAuthor
#5 field_defaults_set_default_value.patch3.6 KBkfu
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

bolaghi created an issue. See original summary.

nickolaj made their first commit to this issue’s fork.

nickolaj’s picture

Status: Active » Needs review

Fixed two bugs in `FieldDefaultsProcessor::processEntityBatch()`: (1) `$hasChanged` flag was not reset per entity iteration, causing incorrect saves across batch items; (2) `$entity` was reassigned to a translation during language processing, which caused the save to operate on the wrong object. Also moved the save logic inside the entity load check to prevent errors when entity loading fails.

kfu’s picture

StatusFileSize
new3.6 KB

@nickolaj Thanks for your work. Since setting the values still didn't work I fixed another bug. The batch process wasn't called.

Attached my patch, working for D11.3.3 with PHP 8.3.23.

darren oh made their first commit to this issue’s fork.

darren oh’s picture

About a year ago the field settings were updated to submit via AJAX. Batches do not run from AJAX submits.

siramsay’s picture

Status: Needs review » Reviewed & tested by the community

I used and tested the patch at #8, and it works.

D11.3.6
PHP8.3.25

b_sharpe made their first commit to this issue’s fork.

b_sharpe’s picture

Status: Reviewed & tested by the community » Fixed

Combined patch into MR. Although #8 works, I don't think it's the correct implementation as it removes ajax from all fields forms.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

  • b_sharpe committed dc0222b6 on 2.1.x authored by nickolaj
    Issue #3572996: Fixed two bugs in `FieldDefaultsProcessor::process...