Skip to content

has and get doesn't seems not to work for imagefields with maxFiles = 1 and auto outputformat #2

@tobaco

Description

@tobaco

if i have images from fields which are restricted to only 1 file, $image gets never defined, because the check with "has" on these fields returns false.
see https://github.com/conclurer/TextformatterSrcset/blob/master/TextformatterSrcset.module#L135

i fixed it for me with the following changes, but did not test it with other fields (so, no pull request for this).

// find the field that holds the image
if (!count($p->get($field->name))) continue;
$image = ($p->get($field->name)->name) ? $p->get($field->name) : $p->get($field->name)->get('name=' . $meta['imageName'] . '.' . $meta['ext']);

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions