Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
Is it possible to backport "uri_callback" in hook_entity_info alter. So as is done in file_entity v2.
This way it is possible to support linkit with media V1.
See corresponding Linkit issuu.
In file_entity.module add
function file_entity_entity_info_alter(&$entity_info) {
$entity_info['file']['uri callback'] = 'file_entity_uri';
and add function
/**
* URI callback for file entities.
*/
function file_entity_uri($file) {
$uri['path'] = 'file/' . $file->fid;
return $uri;
}
Such as done in file_entity V2 should probably do the trick.
Comment | File | Size | Author |
---|---|---|---|
#11 | 1561012-entity-media-uri-callback-comment-fix.patch | 433 bytes | attila.fekete |
#6 | 1561012-entity-media-uri-callback.patch | 1.05 KB | netsensei |
#3 | 1561012-entity-file-uri-callback.patch | 911 bytes | netsensei |
#1 | expand_entity_info-1561012-2.patch | 1.02 KB | mallezie |
Comments
Comment #1
mallezieCreated a patch, and expanded some more info setting. probably not getting in with feature freeze of V1. But i wanted to share. Since it's a solution to make Linkit work with media v1.
Comment #2
Dave ReidEntity URI callbacks should actually go to the "internal" pages or media/%file and not be using file_create_url().
Comment #3
netsensei CreditAttribution: netsensei commentedNeeded this too to get Media 1.x working with Linkit.
Per the comment in #2: The patch uses "file/" . $file->fid One could argue if "media/" . $file->fid would be more fitting, but since we're working on a "File entity", I'd honor the "entity-name/" . $id convention.
Rerolled the patch per the comment in #2.
Comment #4
netsensei CreditAttribution: netsensei commentedComment #5
Dave ReidProblem is in the 1.x branch there is no such path file/%file. It actually lives at media/%file and is exposed by Media module. And so this uri callback should actually be altered in and owned by the media module.
Comment #6
netsensei CreditAttribution: netsensei commentedTaking another stab at this. I've moved the callback to the media module. Linkit keeps working as it should and files are exposed through "media/%file"
Comment #7
netsensei CreditAttribution: netsensei commentedChanging the status.
Comment #9
ParisLiakos CreditAttribution: ParisLiakos commented#6 looks good to me
commited
Comment #11
attila.fekete CreditAttribution: attila.fekete commentedTwo extra '+' signs were left in the comment section, just made a patch to fix that.
Comment #12
netsensei CreditAttribution: netsensei commentedYup. Overlooked those. Patch looks good.
Comment #13
aaron CreditAttribution: aaron commentedThanks for the catch. I've committed it.