Image field title/filename options #895
Replies: 5 comments
-
First of all: I'm glad that this is considered an enhancement! As this is kind of urgent to us (we got ~600Feeds where 300 of them import images and we need to re-run those feeds multiple times daily... resulting in having many unused duplicates that need to be cleaned up every time). Is there any option to interfere with the image saving process of Feed-Me? I.e. an Event that I could potentially hook into to alter the image name based on the |
Beta Was this translation helpful? Give feedback.
-
As of the next release, plugins/module will be able to modify the parsed values of each field, via the use yii\base\Event;
use craft\feedme\services\Fields;
use craft\feedme\events\FieldEvent;
Event::on(Fields::class, Fields::EVENT_AFTER_PARSE_FIELD, function(FieldEvent $event) {
if ($event->fieldHandle === 'myAssetsField' && $event->fieldValue !== null) {
// $event->fieldValue will be an array of assets (already saved).
// Modify the assets or the field value as needed...
}
}); To get the fix early. change your "require": {
"craftcms/feed-me": "dev-develop#272c933b11a3bad21a77fe611c79b47312d5fe91 as 4.1.0",
"...": "..."
} Then run |
Beta Was this translation helpful? Give feedback.
-
@brandonkelly Thanks for this. Could it be an idea to also let other events (notably the I have a feed where I know that I need to do some modification on the values imported to a multiselect field (for instance, there are some different values basically meaning the same, that I would need to set to the value I use in the multiselect). I can use the above addition, but at least for values that are not matching any options in the multiselect, I have an empty Since I know I'm going to have to do this anyways, it would be much cleaner to do it before FeedMe tries to set it to the model, instead of after it predictably fails to do so, and then I could just check for the feed handle and do my thing to the values. |
Beta Was this translation helpful? Give feedback.
-
Please someone let me know if I'm being dumb, but $event->fieldValue, is throwing an unknown property exception, it doesn't appear to exist: Feed Me version: 4.2.0.1 |
Beta Was this translation helpful? Give feedback.
-
@brandonkelly I was looking for an event like |
Beta Was this translation helpful? Give feedback.
-
Description
Having an image (asset-)field to map feed content to while having no control over the resulting image is quite difficult. Especially if you have multiple feeds with the same image name coming from the feed.
Steps to reproduce
Other scenario
www.mydomain.com/image.jpg
as image, second feed haswww.yourdomain.com/image.jpg
. This would result in the later overwriting the first image, just because it has the same name.Additional info
Would be nice to have the option to alter the image name (or on a per property basis for this available fields of the asset) via a text-field that accepts Twig. So something like this would be possible:
pro
user...)Beta Was this translation helpful? Give feedback.
All reactions