Only allowed to map to 'text' fields in Feeds

Created on 19 September 2018, about 6 years ago
Updated 11 June 2022, over 2 years ago

I have a very simple Paragraph with a boolean and a text (plain) field, and based on the module code it's expected that the text field would show up in the Mapping config. However, nothing shows up in the field options list because my plain text field is returning $field_config->getType() as a string and not "text". It appears the only field types currently allowed for Paragraphs are 'text', 'text_long', 'text_with_summary' so I'm just wondering if there was a reason things like 'string' and 'integer' weren't included, or if they were just left out because this was a first pass at feeds support?

Thanks!

🐛 Bug report
Status

Needs work

Version

1.0

Component

Code

Created by

🇺🇸United States possibri

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 8.1 & MariaDB 10.3.22
    last update over 1 year ago
    180 pass
  • 🇬🇧United Kingdom cashburton

    Patch in #9 works, but I needed to add the term 'email' to the patch, for an email field, the below example worked for me:
    Example:
    Line: 86
    - if (in_array($field_config->getType(), ['text', 'text_long', 'text_with_summary', 'string', 'list_string'])) {
    + if (in_array($field_config->getType(), ['text', 'text_long', 'text_with_summary', 'string', 'list_string', 'email'])) {

  • 🇺🇦Ukraine ruslan piskarov Kyiv, Ukraine

    Added the support for email filed type.

  • 🇫🇮Finland anaconda777

    Added manually to patch #22 also "boolean" and it works.

    so the line:
    if (in_array($field_config->getType(), ['text', 'text_long', 'text_with_summary', 'string', 'list_string', 'email'])) {

    Should be

    if (in_array($field_config->getType(), ['text', 'text_long', 'text_with_summary', 'string', 'list_string', 'email', 'boolean'])) {

  • 🇺🇦Ukraine ruslan piskarov Kyiv, Ukraine

    Added 'boolean' mentioned in #23.

  • 🇫🇮Finland anaconda777

    Hi,
    I applied the #24 patch, and tried to map a boolean field. But got error:
    Warning: Array to string conversion in Drupal\paragraphs\Feeds\Target\Paragraphs->getSummary() (line 118 of /var/www/html/site/web/modules/contrib/paragraphs/src/Feeds/Target/Paragraphs.php)
    And then the mapping dissapears from the UI.

    #0 /var/www/html/site/web/core/includes/bootstrap.inc(164): _drupal_error_handler_real()
    #1 /var/www/html/site/web/modules/contrib/paragraphs/src/Feeds/Target/Paragraphs.php(118): _drupal_error_handler()
    #2 /var/www/html/site/web/modules/contrib/feeds/src/Form/MappingForm.php(632): Drupal\paragraphs\Feeds\Target\Paragraphs->getSummary()
    #3 /var/www/html/site/web/modules/contrib/feeds/src/Form/MappingForm.php(481): Drupal\feeds\Form\MappingForm->buildSummary()
    #4 /var/www/html/site/web/modules/contrib/feeds/src/Form/MappingForm.php(160): Drupal\feeds\Form\MappingForm->buildRow()
    #5 [internal function]: Drupal\feeds\Form\MappingForm->buildForm()
    #6 /var/www/html/site/web/core/lib/Drupal/Core/Form/FormBuilder.php(536): call_user_func_array()
    #7 /var/www/html/site/web/core/lib/Drupal/Core/Form/FormBuilder.php(375): Drupal\Core\Form\FormBuilder->retrieveForm()
    #8 /var/www/html/site/web/core/lib/Drupal/Core/Form/FormBuilder.php(633): Drupal\Core\Form\FormBuilder->rebuildForm()
    #9 /var/www/html/site/web/core/lib/Drupal/Core/Form/FormBuilder.php(325): Drupal\Core\Form\FormBuilder->processForm()
    #10 /var/www/html/site/web/core/lib/Drupal/Core/Controller/FormController.php(73): Drupal\Core\Form\FormBuilder->buildForm()
    #11 [internal function]: Drupal\Core\Controller\FormController->getContentResult()
    #12 /var/www/html/site/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array()
    #13 /var/www/html/site/web/core/lib/Drupal/Core/Render/Renderer.php(627): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
    #14 /var/www/html/site/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(121): Drupal\Core\Render\Renderer->executeInRenderContext()
    #15 /var/www/html/site/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext()
  • 🇳🇱Netherlands megachriz

    @Anaconda777
    For the error that you are facing, there is 🐛 Adding a 'Paragraphs' field to a Feed's mapping throws error RTBC .

  • 🇫🇮Finland anaconda777

    @MegaChriz
    Alright thanks, I applied the patch from https://www.drupal.org/project/paragraphs/issues/3177867 🐛 Adding a 'Paragraphs' field to a Feed's mapping throws error RTBC
    And the error is gone, but still the mapping disappears.

    I think I am doing it wrong, I try to import data from CSV to content type with processor "quiz question" and "quiz question type: multiple choice question" but I guess it is not possible, cos it has fields which are paragraphs.

  • 🇳🇱Netherlands megachriz

    Tagging with "Feeds", so all Feeds related issues can be found together that way.

  • 🇺🇦Ukraine ruslan piskarov Kyiv, Ukraine

    Added 'datetime' field type.

Production build 0.71.5 2024