Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Attempting to remove a field collection element results in an AJAX error like that below (custom block) or depicted in the attached screenshot (node). From a user perspective, it just seems like nothing happens when you click the "Remove" buttons.
12:43:23.843 AjaxError:
An AJAX HTTP error occurred.
HTTP Result Code: 200
Debugging information follows.
Path: /block/add/test?element_parents=field_test/1&destination=/admin/structure/block/block-content&ajax_form=1&_wrapper_format=drupal_ajax
StatusText: OK
ResponseText:
( ! ) Fatal error: Call to undefined function Drupal\field_collection\Plugin\Field\FieldWidget\drupal_process_attached() in /var/www/nasdaqir/modules/contrib/field_collection/src/Plugin/Field/FieldWidget/FieldCollectionEmbedWidget.php on line 415
Comment | File | Size | Author |
---|---|---|---|
#5 | ajax-error-on-remove--2597842-5.patch | 699 bytes | balsama |
| |||
#2 | 2597842-screenshot.PNG | 79.8 KB | kiwad |
Comments
Comment #2
kiwad CreditAttribution: kiwad commentedComment #3
zaphoyd CreditAttribution: zaphoyd commentedI can confirm and reproduce this issue. Seems to be related to the deprecation of drupal_process_attached(). Some more discussion here: https://www.drupal.org/node/2565285. I resolved this by trying the first suggestion there (simply removing the call to drupal_process_attached entirely) and it fixes the error and appears to work. I don't know quite enough about what is actually going on here to determine if this is a good long term solution.
Comment #4
TravisCarden CreditAttribution: TravisCarden at Acquia commentedComment #5
balsamaFrom drupal_process_attached() has been removed:
So I think you are correct that the function should just be removed. Patch attached.
Comment #6
TravisCarden CreditAttribution: TravisCarden at Acquia commented[comment removed by author]
Comment #7
TravisCarden CreditAttribution: TravisCarden at Acquia commentedThe patch in #5 fixes the AJAX error. In my case, it allows the manifestation of a related issue: #2613584: Removing field collection item from nested field collection removes all field collection items under parent. But this patch seems good.
Comment #8
tim.plunkettComment #11
tim.plunkettComment #13
PierreADV CreditAttribution: PierreADV commentedI'm having a similar issue on the 8.x-3.x-dev version.
On a node with a lot of items (approximately 30) it's impossible to remove the elements positioned at the top of the list. Nothing happens and it returns an AJAX error in the console. The elements at the bottom of the list can be removed though.
Comment #14
vjkaran CreditAttribution: vjkaran commentedI'm facing a similar issue with nested filed collections on node. Is there any workaround for this issue?