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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

axlroach’s picture

FileSize
2.33 KB

Whoops! Forgot to add the help text for the new ooyala_base_url variable! Re-rolled patch below.

axlroach’s picture

quicksketch’s picture

Thanks, great suggestions! I'll review this shortly.

axlroach’s picture

Had used $base_url in error (instead of $base_path) when building the link for the 'hosted_at' key of the $params array.

axlroach’s picture

Tweaked a bit to use path aliases for permalinks instead of node/xxxx .

quicksketch’s picture

I 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.

quicksketch’s picture

Title: Use entity_uri for building the ooyala permalink / Make the base url for permalinks configurable » Use entity_uri for building the ooyala permalink
Status: Needs review » Fixed

I've committed #6, we can reopen this or make a new issue to address the ability to make a custom domain setting.

  • quicksketch committed c219d9e on 7.x-2.x
    Issue #2231837 by axlroach, quicksketch: Use entity_uri for building the...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.