Skip to content
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

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

Open
tobaco opened this issue Oct 28, 2014 · 2 comments
Labels

Comments

@tobaco
Copy link

tobaco commented Oct 28, 2014

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']);
@philippreiner
Copy link
Contributor

Thanks for the info. I'll try your fix and put it into the next verion together with some other small code improvements.

@jmartsch
Copy link

Please merge this fix. I can confirm it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants