Skip to content

$content->setFieldValue('image', 'image.png'); doesn't work #3481

@Saltibarsciai

Description

@Saltibarsciai

Can't update/create image field in fixtures

    protected function load(ContentFactory $factory): void
    {
        $content = $this->factory->create('image');

        $content->setFieldValue('slug', 'icon');
        $content->setFieldValue('image', 'image.png');

        $this->factory->save($content);
    }

Details

Question Answer
Relevant Bolt Version 5.1.20
Install type composer
PHP version 8
Web server Nginx
For UX/UI issues Browser name and version

Reproduction

  1. have a contentype
image:
    name: Images
    slug: image
    singular_name: Image
    searchable: false
    viewless: true
    fields:
        slug:
            type: slug
        image:
            type: image
  1. update/create record
        $content = $this->factory->create('image');

        $content->setFieldValue('slug', 'icon');
        $content->setFieldValue('image', 'image.png');

        $this->factory->save($content);

Bug summary

Problem is text fields are updated as expected, but not image field

Specifics

* Mention the URL where this bug occurs, if applicable
* What version of Bolt are you using (down to the very last digit!) 5.1.20
* What method did you use to install Bolt - composer
* What browser and version you are using - using cli

Expected result

Image gets updated

Actual result

text fields are updated, image field not

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions