OEmbed field (extracted from sheadawson/linkable)

Installs: 1

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 0

Open Issues: 0


0.1 2021-06-16 04:42 UTC

This package is auto-updated.

Last update: 2022-06-16 07:21:51 UTC


This module contains an OEmbeddable DataObject and a OEmbeddableField to easily add oEmbed content to a DataObject or Page. These were extracted, renamed & improved from linkable so they can be used on their own. (We use NamedLinkField module instead of Linkable).

Example usage

Add a $has_one to OEmbeddable and insert OEmbeddableField to manage its contents.

use Restruct\Silverstripe\OEmbedable\OEmbeddable;
use Restruct\Silverstripe\OEmbedable\OEmbeddableField;

class Page extends SiteTree
	private static $has_one = [
		'EmbedVideo' => OEmbeddable::class,

	public function getCMSFields()
		$fields = parent::getCMSFields();

		        'Video from oEmbed URL',

		return $fields;

In your template, you can render the object with the name of the has_one relation


You can also access other metadata on the object via


Switching from Linkable to OEmbeddable

Probably you should be able to use the upgrader tool, the new classnames are included in .upgrade.yml but I haven't tested this.

To upgrade manually, simply remove the Linkable module

Keep Linkable module alongside OEmbeddable

NOTE: in case you're actually using the Linkable fields you may either just stay with that module OR change the $table_name for OEmbeddable (or the EmbeddedObject of Linkable). Then the two should be able to coexist peacefully alongside eachother. (In the SS4 updated version of Linkable we had to correct the value $table_name anyway).

You may correct the value of $db_field after a SS3->4 upgrade via Yaml config:

  table_name: 'EmbeddedObject'

You may update/change its value (or that of OEmbeddable) to make the two work alongside:

  table_name: 'LinkableEmbeddedObject' # this way OEmbeddable can use EmbeddedObject as table_name

OR change OEmbeddable to use a different table_name (remember to also correct that of Linkable):

  table_name: 'OEmbeddable'