Hi
I prepared a CSV file where I also have columns for Metatag Description, Abstract and Keyword.
When importing them I do not get an error, but the following warnings or bugs afterwards:
1. In the log messages I get for example these warnings/information
Notice: Undefined variable: entity_type in metatag_feeds_set_target() ...... row 61 in ll/modules/metatag/metatag.feeds.inc
2. Interestingly metatag keyword is imported, but abstract and description not
3. When displaying a node with imported metatags I get sometimes these log entries
Warning: preg_match_all() expects parameter 2 to be string, array given in token_scan() (Zeile 124 von /includes/token.inc).
I tested this with the 7.x.-20 alpha 8 as well a version with the patch for handling spaces.
Can it be that metatag text import in general does not yet work?
thanks
| Comment | File | Size | Author |
|---|---|---|---|
| #12 | taxonomyregiontest.zip | 1.05 KB | beauregard |
| #8 | feeds-import-existing-metatag-entity-type-2417155-8.patch | 796 bytes | dobe |
Comments
Comment #1
megachrizSounds like a bug in the metatag module. Moving this issue to that project.
Comment #2
damienmckennaWhat version of Feeds is being used? There was a bug fixed in 1.3 (#2347193: Feeds integration borken in 1.0)?
Comment #3
beauregard commentedI am using Feeds 7.x-2.0-alpha 8
and Metatag 7.x.1.4
Comment #4
inversed commentedI recently started experiencing this with Feeds 7-x-2.x-alpha8+71-dev. What I'm seeing is that the meta tag gets written to the node as an indexed array instead of a single value. This is visible using Devel. Additionally, the imported meta tags do not display in the markup.
I get something like this (the value element is an array and it should be a string):
$node->metatags['und']['og:image']['value'][0] (String')After editing and saving the imported node manually (without changing anything), the error goes away, in particular the error with the token.
Comment #5
inversed commentedI was in a hurry and needed a one off fix for a content import so I hacked the metatag.feeds.inc file at the bottom. In my case, I only needed a single metatag so I knew what kind of data was going through that $value.
Comment #6
megachrizThe problem in #4 looks related, but has a different cause. In the dev version of Feeds, the "value" in the mapping target callback is now always an array. This is done to provide consistency across all mappers. See the change record: https://www.drupal.org/node/2301995
This change doesn't exist in Feeds 7.x-2.0-alpha8, which beauregard reports he/she is using that.
The problem in #0 seems to be caused by having the following condition
FALSE:if (!isset($entity->metatags) && !empty($entity->feeds_item->entity_id) && is_numeric($entity->feeds_item->entity_id)) {Because after this code the variable
$entity_typeis used, but if the condition above results intoFALSEthis variable is undefined.Comment #7
megachrizComment #8
dobe commentedI ran into this issue as well. #6 brings out the correct issue. It seems that when you have an existing entity with metatag data. $entity_type does not get set.
Attached is a patch that brings the entity_type variable out of the if statement as we use it later no matter what.
Comment #9
dobe commentedComment #10
beauregard commentedI tested it, but I still have the same problems:
1. Meta Description and Meta Abstract are not imported (Meta Keyword is imported)
2. I get errors in the reports-section
I have to say that I manually adjusted metatag.feeds.inc (current active version), maybe I made an error, but as I understand only 3 lines are to be added and one to be removed.
Comment #11
dobe commentedCould you do a feed export and give a a dummy csv? That way we can test exactly what your doing. I have noticed something like this in the past if your csv is not saved using UTF-8. Without testing it though I am unsure.
Comment #12
beauregard commentedHi, thanks for your message. Please find enclosed the two files (feed importer and file being imported)
About UTF-8: Yes, I know. This problem I had too when I started with feeds, but I know that it must be UTF-8 and I set it to UTF-8 in PSPad Editor. Besides that, importing nodes works fine.
Please note that I am using a patched version of feeds. I applied these two patches:
1. Unpublish / Delete Nodes (#204 at https://www.drupal.org/node/1470530#comment-9077209 )
2. Handle Empty Fields (https://www.drupal.org/node/1107522. The patch is in #161.)
However, when I reported this bug, I tested also with the normal most recent feeds version.
About errors:
1. Importing does not give any errors. Taxonomy terms are imported, the only thing missing is Metatag Description and Abstract
2.As soon I visit a taxonomy term page I get errors
The last error I got only when I called one term the first time. With other terms it did not appear.
Also the error do not appear always.
Comment #13
dpastov commentedcomment #8 fix the issue. I've unfortunately missed this ticket and created my own one with exactly same fix :)
$entity_type is not set during import
Comment #14
damienmckennaClosed a duplicate: #2470019: $entity_type is not set during import
Comment #15
damienmckennaCommitted. Thanks.