In Part 1 of this series, I showed an easy system for including oEmbed rich content in a WYSIWYG, including reusing that content. In this installment I'll step through how to set it all up in Drupal 7.
How to Set Up Asset and oEmbed modules
First of all, in order to use Asset module you can't use WYSIWYG module - you need to use CKeditor module. CKeditor module is great though - you have more control of your editor configuration than with WYSIWYG module.
Install Asset module from drupal.org: I typically enable only Asset, Asset document, and Asset image, out of the submodules in the Asset package.
Similar to how Media module works, you need to enable the Asset filter on your input format(s). On the CKeditor settings make sure you enable the Media Asset plugin.
Also add oEmbed module and enable its submodules oEmbed Field oEmbed Embedly. Add an API key to the oEmbed Embedly configuration.
Create a new Asset type (Structure: Asset Types: Add Asset Type) called 'Embed' and pick an icon for it. At 'Manage Fields' add a link field, and at 'Manage Display' choose oEmbed for the display formatter of the link (for both Default and Full Size modes). Go back the CKeditor settings and drag your new button into your WYSIWYG configuration.
You may also want to do some templating and styling: I overrode the oembed.tpl.php from oEmbed to not show an extra title link to the embed. I also overrode the asset.tpl.php to likewise not show the Asset title.
OK, but what if I want to add this as a field, rather than in a WYSIWYG?
Media module has a nice ability to be used as a widget for a file field, letting you reuse media from your library or add new media. So how can we get a similar feature using our beloved Asset module library? Because Asset is an entity type, you can create entity reference fields to reuse assets. A great widget for entity reference fields is Inline Entity Form. This lets you add a new or existing asset of any type as a field. We contributed a patch for Asset to add support for Inline Entity Form, which is in the latest Dev release of Asset module.
Do I have to do this for every new site I make?
Of course not. This is the kind of setup you should do in a starter-kit: an install profile that you use for every site. We've added it to our Bear Starter-kit, which you're welcome to fork.
OK, but what if I use Scald or Media module and can't switch to Asset?
If you're not ready to make the Asset module plunge, you can still use oEmbed. If you like Scald, you can do a similar setup using this Embedly Scald module. And if you use Media module you can use the Media oEmbed submodule (included in oEmbed module).