Jump to content

Developer Documentation

Supporting content embedding in Content Items

Throughout the IPS Community Suite, content items can be embedded in other content, generating a small preview of the content. You can support this kind of embedding in your own content items, allowing them to be embedded elsewhere in the suite.

Note: You must have implemented the ContentRouter extension for embedding to be supported.

 

How to implement embedding

First, you need to implement the embedding interface in your content item model, like so:

implements \IPS\Content\Embeddable


Next, ensure that the URLs to your content contain an “id” parameter which is the primary ID of your content. If this is not the case, you will need to override the loadFromUrl() method in your class (this is defined in \IPS\Patterns\ActiveRecord):

public function loadFromUrl( \IPS\Http\Url $url )
{
	return static::load( ... );
}

The controller and model will automatically support embeds using a generic template. If you want to provide a custom template, override the embedContent() method on your model and return different HTML:

string embedContentarray $params )
  • $params (array, required)
    Additional parameters that were passed in the embed URL.

  Report Document


×
×
  • Create New...