Closed (fixed)
Project:
Metatag
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
5 Dec 2012 at 14:39 UTC
Updated:
2 Aug 2013 at 13:31 UTC
Jump to comment: Most recent file
Comments
Comment #1
msmithcti commentedComment #2
damienmckennaComment #4
damienmckennaThis might work better.
Comment #5
multpix commented#4 works well
do not forget to comment out the line 15 - who is without devel
Comment #6
msmithcti commented@DamienMcKenna - Do you have a link to somewhere that explains creating patches with new files?
@multpix - Thanks for spotting that! Here's an updated patch:
Comment #8
damienmckennaRerolled.
Comment #9
damienmckenna@splatio: What you do is you "add" all changes you want, inc new files, and then "git diff HEAD" will show all changes against the latest code from upstream.
Comment #10
rohit.wadhwa commentedwhen i disable the devel module this patch is not working. please check this issue.
Not able to visit this link : http://[site_domain]/admin/structure/feeds/testimonials_importer/mapping/ for mapping fields.
Comment #11
multpix commentedneed comment string with dpm($info);
Comment #13
multpix commentedups
Comment #14
msmithcti commentedThanks for reminding me about this! This patch should apply and doesn't have a stray call to dpm() in it :)
Comment #15
rohit.wadhwa commentedNo idea but still when we disable devel module this is not working. Not looking logical but can you test this case ?
Comment #16
siefca commentedSame here. I added
include_onceto enable it but no results. Seems the hook is not even called.Comment #17
damienmckennaMaybe it needs to be added to the main metatag.module file?
Comment #18
damienmckennaFeeds v2.0alpha4 mentions the following in the changelog:
So in theory this should just work. Maybe the site caches need to be cleared after applying the patch?
Comment #19
damienmckennaAfter applying the patch I get the following in the Feeds mapping page as options for the field target:

Comment #20
damienmckennaCommitted, thanks for the contribution!
Comment #21
damienmckennaA tiny follow-on patch to add some comments, rename the $type variable and tweak the formatting a little.
Comment #22
damienmckennaComment #23
damienmckennaCommitted.
Comment #24
damienmckennaThis additional follow-up provides a slight improvement to the field names, it now says e.g. "Meta tag: Description" rather than "Metatag Description" and uses the meta tag's actual description field rather than just repeating the meta tag's label.
Comment #26
damienmckenna#24: metatag-n1859136-24.patch queued for re-testing.
Comment #27
damienmckennaCommitted. We're good for now.
Comment #28
pnigro commentedI am sorry to reopen this but I am getting some odd behaviors when testing Meta tags 7.x-1.x-dev (March 17th) with Feeds 7.x-2.0-alpha7. I added Meta: Keyword and Meta: Description to the feed mapping and set the processor to Update existing nodes. I then added the keyword and description data to a .csv file and imported it. The keyword data was added to the existing nodes, but the description data wasn't. It was still set to the default "[node:summary]". I also tried the Meta: Abstract field and it was empty after import. I double checked the names of the columns in the .csv file and they were correct.
Although the keyword field updates, it only updates when a node's initial keyword value is empty. If you try to update an existing keyword field then the field stays the same.
So to summarize:
I have not tested the remaining Meta tag fields. If you need any more information please let me know.
Thanks
Paul
Comment #29
pnigro commentedForgot to set status
Comment #30
damienmckennaCan you please check what data is added to the {metatag} table? The 'data' field should have something like:
a:1:{s:5:"title";a:1:{s:5:"value";s:33:"The title goes here | [site:name]";}}Comment #31
damienmckennaI ran a test import and it worked as expected, the values were inserted into the database correctly:
a:3:{s:11:"description";a:1:{s:5:"value";s:27:"It's a monkey's description";}s:8:"keywords";a:1:{s:5:"value";s:22:"Itsa, monkey, keywords";}s:5:"title";a:1:{s:5:"value";s:21:"It's a monkey's title";}}Next to test updating the records.
Comment #32
damienmckennaOk, I can confirm that the values are not updated correctly, but the initial records are at least correctly imported initially.
Comment #33
damienmckennaI caught the problem - the old data was being stored in $entity->metatags[$langcode] while the new values were being stored in $entity->metatags as normal; this patch adjusts metatag_metatags_save so that it only uses the $entity->metatags[$langcode] values if there aren't any others to use.
Comment #34
damienmckennaCommitted.
Comment #35
damienmckennaNow that Metatag v7.x-1.0-beta5 is out am closing this to keep the issue queue clean.
Comment #36
pnigro commentedHello,
I tried updating only the meta keyword tags using Feeds and after import the meta tag descriptions, which were previously set, are now deleted. Steps to reproduce include the following:
If you update both meta keyword and description tags at the same time, they both update. If you need any more information please let me know.
Thanks
Paul
Comment #37
plopescHello
pnigro was right. When you try to override only part of the metatag properties, it overrides full metatags object and poperties not defined in feed are removed.
Attaching a patch that loads the full metatag object when exists and override only new values.
Regards
Comment #38
plopescHello
Attaching improved patch.
Regards.
Comment #39
damienmckennaUnfortunately loading the existing entity's data is more complicated, you can't just use $entity->language anymore, you need to use metatag_entity_get_language().
Comment #40
plopescPatch re-rolled following your suggestions.
Thanks for your support!
Comment #41
damienmckennaI prefer using !empty($var) rather than just doing $var != 0.
Comment #42
plopescOK, it's good for me ;)
Only one question:
Is necessary check if entity_id is numeric? I think this value are always numeric if not empty, but maybe I'm wrong.
Regards
Comment #43
damienmckenna@plopesc: I haven't tested it yet to know what the $entity data structure is like at that point, it's just an added precaution.
Comment #44
plopesc@DamienMcKenna: AFAIK, entiy_id is 0 if the entity is being created by feeds in that moment or the numeric entity_id if the entity is being edited by feeds ;)
Comment #45
kingandyPatch from #33 does not appear to be present in 7.x-1.x-dev or 7.x-1.x-beta7 (both released after reported commit date). Is this something that's been reverted since?
Comment #46
damienmckenna@kingandy: The code has since been improved so those lines don't appear exactly the way shown in that patch anymore. You might want to also review #2020565: Records for nodes have the wrong language value during initial creation.
Comment #47
kingandyAh, that makes sense, thanks! I'll move towards testing #41...
Comment #48
damienmckennaCommitted.