Problem/Motivation

I read in the code that basefields are if-checked and opted out of field_types that are to be copied under BulkCopyFieldsForm.php. I then googled it to possibly find out about the downsides to get data from a basefield but couldn't find anything.

I needed so desparately to copy the Placed date (base) field of commerce_order entity type to another date field that is user-defined in the interface. I deleted those if-checks and could get a list of basefields in the Copy From step. On the next step I got the following error:

Notice: Undefined index: placed in Drupal\bulk_copy_fields\Form\BulkCopyFieldsForm->buildForm() (line 236 of modules/contrib/bulk_copy_fields/src/Form/BulkCopyFieldsForm.php).

I think this means that it is not opting out the source field at some point while building the option list for the target fields. It may be the same issue with #3033221: Error when trying to copy date field

In the target list there was only completed field, which is also a base date field. My user-defined date field wasn't listed. I wasn't able to find the code where the target list is built. Do you think I should force in this direction? If yes, can you give a hint?

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

CommentFileSizeAuthor
#3 3178990-3.patch5.73 KBel1_1el

Comments

durum created an issue. See original summary.

el1_1el’s picture

Version: 8.x-1.0-alpha4 » 8.x-1.x-dev

I have some time at the moment and am working on this. The issue is dates can be returned as datetime, date or daterange. created and revised are timestamps so they have to all be converted correctly for it to work. will post a patch and/or a commit to dev when ready.

el1_1el’s picture

StatusFileSize
new5.73 KB

This should do it. I'll commit to dev branch also. Open back up if you have issues.

  • el1_1el authored 8cb2f73 on 8.x-1.x
    Issue #3178990 by imperator_99, durum, el1_1el: Why are base fields not...
el1_1el’s picture

Category: Support request » Feature request
Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.