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.
Problem/Motivation
commerce_product_handler_field_product_link
does not use entity_uri()
, but constructs entity URLs itself, completely bypassing any other module's abilities to alter the URL.
Proposed resolution
Make the Views field handler use entity_uri()
instead of constructing URls itself.
Remaining tasks
None.
User interface changes
No changes, but additions. The field now extends Views' URL field base class, rather than the generic field base classes.
API changes
None.
Data model changes
Comment | File | Size | Author |
---|---|---|---|
#2 | commerce_2604290_2.patch | 1.39 KB | Xano |
Comments
Comment #2
XanoComment #3
mglamanComment #4
joelpittetI could be wrong but shouldn't this be a new handler called
commerce_product_handler_field_product_url
? Before it was returning a link tag and now it's returning a URL. Something is not fitting.Comment #5
mglamanChanged from render to get_value, because views_handler_field_url renders a link.
Drills into
Now it uses Entity API to properly render link
Comment #6
Xano@mglaman: Did you accidentally forgot to attach a patch?
Comment #7
mglamanXano, I moved it back to CNR for your patch as it's proper in my opinion.
Comment #8
joelpittet@mglaman if
views_handler_field_url
renders a link, and this is being changed to use that class, shouldn't this also render a link as it did before then? Either the name is really confusing or I am missing something...Comment #9
joelpittetTo clarify my concern the render() to get_value() override looks fine, my only concern is the confusing class name.
Comment #10
joelpittetMaybe we can't do anything about that but yeah...
Comment #11
XanoIt looks like you're right. I just haven't had the chance to look at this code again.