- Issue created by @leeksoup
- πΊπΈUnited States generalredneck Texas, USA πΊπΈ
Ok, Give me the week please. I still "kinda" maintain the D7 version as I just mostly get in maintenance fixes like this one.
As for pointers... the first thing I would do is do as you say... pick up lando, install the Drupal 7 recipe, install this module, put a conditional breakpoint at line 232 https://git.drupalcode.org/project/views_natural_sort/-/blob/7.x-2.x/vie...
looking for "$field_name='mime'" and see what entity comes up. You should be able to repeat this process by running cache clear and hitting the "Reindex button" on admin/structure/views/settings/views_natural_sort.
I gave it about 15 minutes this morning looking for a quick work around for you and the best I've got at the moment is to implement
hook_views_natural_sort_get_entry_types_alter
and unset mime fields if you need an immediate fix.
https://git.drupalcode.org/project/views_natural_sort/-/blob/7.x-2.x/vie...I didn't know the fork was being maintained over there. I seem to remember vaguely someone asked to port it.
- πΊπΈUnited States keiserjb
I'll take a look at those tips. Yes, I've been messing around with this in Backdrop. Since we are talking about it I'll probably move it over to Backdrop Contrib and out of my personal GitHub but it's not ready for release.
- πΊπΈUnited States keiserjb
- πΊπΈUnited States keiserjb
When it gets to the last step of the indexing the 'content' index of the array for the mime is null. I changed the line to set it to an empty string if it wasn't set. Don't know if this is correct, but the undefined index is gone and the titles are in the correct order.
'content' => (isset($entity->$field_name) ? $entity->$field_name : ""),
- Status changed to Needs review
about 2 years ago 1:23pm 3 April 2023 - πΊπΈUnited States generalredneck Texas, USA πΊπΈ
@keiserjb, @leeksoup,
This is a patch against the Drupal version obviously... but here's the short of the explanation. In the modules I'm using drupal core's function "entity_get_info". The challenge here is that while this lists all the properties, it doesn't necessarily line up 1 for 1 with the objects that get pulled back from "entity_load". That said the Entity API β module (which Views Natural Sort relies on) supports using those property short hand names in entity wrappers because it does the magic of doing the translation from the module defined entity properties in hook_entity_info() to what the objects require to be pulled from and written to the database.
In Backdrop, you MAY have to rewrite the dependency to work with Entity Plus.
- πΊπΈUnited States keiserjb
Installed the patch in Drupal 7 and the undefined property is gone. Thank you!
- πΊπΈUnited States keiserjb
#6 might not play nice with the Rules module.
EntityMetadataWrapperException: Invalid data value given. Be sure it matches the required data type and format. in EntityBackdropWrapper->set() (line 761 of /app/modules/contrib/entity_plus/includes/entity_plus.wrapper.inc).
- Status changed to Needs work
almost 2 years ago 3:28pm 29 April 2023 - πΊπΈUnited States generalredneck Texas, USA πΊπΈ
@keiserjb,
Sorry I couldn't meet up at Midcamp contrib day, That said I'm going to take a second look at this. just to recap some of the stuff we talked about in slack and in person:keiserjb
I don't think the patch you made plays nicely with the Rules module. I happened to have it on in the Backdrop site I'm using Views Natural Sort on. Indexed it and gotEntityMetadataWrapperException: Invalid data value given. Be sure it matches the required data type and format. in EntityBackdropWrapper->set() (line 761 of /app/modules/contrib/entity_plus/includes/entity_plus.wrapper.inc).
Then for fun I tried it on D7. Got the same.EntityMetadataWrapperException: Invalid data value given. Be sure it matches the required data type and format. Value at rules_config(): 1. in EntityDrupalWrapper->set() (line 765 of /app/sites/all/modules/entity/includes/entity.wrapper.inc).
This seems to be a known issue with EntityMetadataWrappers. see a related issue #2143171: Entity Metadata Wrapper support broken for named, exportable entities. β . This is going to happen on some entities like rules maybe?
A work around may be to implement something like #3189631: Not all records provide an integer for eid: Fatal error β for D7.
Looking into this further.
- Status changed to Needs review
almost 2 years ago 4:12pm 29 April 2023 - last update
almost 2 years ago 10 pass - πΊπΈUnited States generalredneck Texas, USA πΊπΈ
Give this a shot. I think I've got it worked out.
- πΊπΈUnited States keiserjb
When I turn on rules I still get a notice.
Notice: Undefined property: RulesReactionRule::$plugin in views_natural_sort_views_natural_sort_queue_rebuild_data() (line 233 of /app/sites/all/modules/views_natural_sort/views_natural_sort.module).
- last update
over 1 year ago 10 pass - πΊπΈUnited States generalredneck Texas, USA πΊπΈ
This appears to work and passed all tests for me. let me know if you have a different experiance
- πΊπΈUnited States keiserjb
Looks like this works. I finally tried it.