backdrop-contrib / paragraphs

Paragraphs module to control your content flow
https://backdropcms.org/project/paragraphs
GNU General Public License v2.0
5 stars 11 forks source link

Warning: uasort() expects parameter 2 to be a valid callback, function 'element_sort' not found or invalid function name #128

Closed yorkshire-pudding closed 2 years ago

yorkshire-pudding commented 2 years ago

Steps to reproduce

  1. Create basic text paragraph bundle
  2. Create image paragraph bundle
  3. Ensure errors message display is set to 'All messages' or 'Errors and warnings'
  4. Add paragraph field to content type

Expected result Form loads normally

Actual result Warning: uasort() expects parameter 2 to be a valid callback, function 'element_sort' not found or invalid function name in theme_paragraphs_bundle_settings_form() (line 718 of /app/docroot/modules/paragraphs/paragraphs.module). Form appears to work normally and I don't get any errors if messages switched off though probably would appear in the log.

Line in question in current code base is: https://github.com/backdrop-contrib/paragraphs/blob/e1d39254e38cfccca5d323dda60293d485858154/paragraphs.module#L720

laryn commented 2 years ago

Hmm, strange. I can't dig deeper right now but that pattern/function seems to be in use in at least one case in core:

https://github.com/backdrop/backdrop/blob/c982552fa3724a58a7be1371d4b76184cebdc359/core/modules/file/file.module#L3278

yorkshire-pudding commented 2 years ago

Very odd - not causing any blockages right now, but thought it was worth logging.

laryn commented 2 years ago

Is Drupal compatibility turned off on the site you're working on?

https://docs.backdropcms.org/api/backdrop/core%21includes%21drupal.inc/function/element_sort/1

laryn commented 2 years ago

Looks like this function has been deprecated and should be replaced. (In core, too, in at least a few places/references)

yorkshire-pudding commented 2 years ago

Yes, it is switched off. Just done search for it: image

laryn commented 2 years ago

Care to open a core issue for this, too? The functions in drupal.inc obviously stay (at least until Backdrop 2.0) but the others should probably be fixed/cleaned up.

yorkshire-pudding commented 2 years ago

Yes, ok - done at https://github.com/backdrop/backdrop-issues/issues/5535

It's a bit sparse as I'm not sure what steps I need to take to trigger the warning in core

laryn commented 2 years ago

@yorkshire-pudding I think this is fixed in the latest dev version -- feel free to test.