- 🇵🇹Portugal jrochate
Hi.
Can you share how did you made possible to have Author field available on the Reference feeds mapping field list?
The field keywords can already be seen on feeds' mapping, but author field is not.
Thanks.
Feeds module allows to import Bibcite entities but there are two main problems importing References:
1) the author field cannot be populated: this bug can be solved with a custom FeedsTarget plugin.
2) the keyword field cannot be populated: this bug cannot be solved with a custom FeedsTarget plugin.
The problem is the definition of the two fields: the first (authors) is a completely new field type, than you can create a Feeds plugin to manage it, the second field (keywords) is an custom entity_reference field. Feeds module already has a plugin to manage this type of fields but something on the Keyword entity Class is wrong because the following code breaks:
$query = $this->entityTypeManager->getStorage($entity_type_id)->getQuery();
if (!empty($bundles) ) {
$query->condition($this->getBundleKey($entity_type_id), $bundles, 'IN');
}
$query->condition($field, $search);
if (!$multiple) {
$query->range(0, 1);
}
$result = array_filter($query->execute());
This code is on the Feeds EntityFinder.php Class, it's the query on findEntities() method which looks for existing entity references (in our case keywords).
The error is on the following line:
$query->condition($this->getBundleKey($entity_type_id), $bundles, 'IN');
because Keyword class returns "bibcite_keyword" as bundle, but getBundleKey() returns an empty result.
This is getBundleKey() code:
protected function getBundleKey(string $entity_type_id) {
return $this->entityTypeManager->getDefinition($entity_type_id)->getKey('bundle');
}
If you debug the code you will find that the Keyword object is Drupal\Core\Entity\ContentEntityType and the entity_keys array contains the following data:
[entity_keys:protected] => Array
(
[id] => id
[label] => name
[uuid] => uuid
[langcode] => langcode
[revision] =>
[bundle] =>
[default_langcode] => default_langcode
[revision_translation_affected] => revision_translation_affected
)
As you can see the 'bundle' value is empty.
Currently I've solved patching the Feeds module skipping the following line when processing bibcite_keyword:
$query->condition($this->getBundleKey($entity_type_id), $bundles, 'IN');
But a much cleaner solution should be provided.
I supect the Keyword entity in the Biblio module is not completely correct because it doesn't behave as expected.
Thank you for the attention.
Active
2.0
Code
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
Hi.
Can you share how did you made possible to have Author field available on the Reference feeds mapping field list?
The field keywords can already be seen on feeds' mapping, but author field is not.
Thanks.