Problem/Motivation
Currently the permalink url is being constructed using url(). This isn't ideal for ooyala assets that are stored as field_collection_items, and it requires separate cases for aliased vs non-aliased paths. In addition, the current way that the permalink is constructed uses the site's base url. This poses a problem if for example you are testing ooyala assets on a dev/qa/staging, but don't wish to have the permalinks saved to backlot link to a dev/qa/staging site.
Proposed resolution
Remove the url() functions and use entity_uri() instead. Also add a drupal variable to the ooyala settings form to store the preferred base url for permalinks. This can default to the global $base_url.
Comments
Comment #1
axlroach CreditAttribution: axlroach commentedWhoops! Forgot to add the help text for the new ooyala_base_url variable! Re-rolled patch below.
Comment #2
axlroach CreditAttribution: axlroach commentedComment #3
quicksketchThanks, great suggestions! I'll review this shortly.
Comment #4
axlroach CreditAttribution: axlroach commentedHad used $base_url in error (instead of $base_path) when building the link for the 'hosted_at' key of the $params array.
Comment #5
axlroach CreditAttribution: axlroach commentedTweaked a bit to use path aliases for permalinks instead of node/xxxx .
Comment #6
quicksketchI found some issues with this patch. It removes the check for
$entity->path['alias']
, which is important because for nodes, the alias hasn't yet been set by the time this code is called. So for new nodes the alias would not get used (unless it were edited a second time).I'm also not totally sure about making a UI for customizing the base URL, so for now I've adjusted the approach to use entity_uri() instead of entity_extract_ids(), but otherwise I've left everything the same. In the mean time if you need to use a different URL, you can use
hook_ooyala_field_asset_patch_alter()
to replace the domain name with a different one.Comment #7
quicksketchI've committed #6, we can reopen this or make a new issue to address the ability to make a custom domain setting.