Jump to content

Custom Embeds


GriefCode

Recommended Posts

Hey,

is there anywhere an topic how i can create a custom embed in the ckeditor?
Like if im including a topic within a post?

I would have basically a link to one of my applications and i would like to display it not as plain link, there should be some info around.

Any referencing code would be also nice :-)

 

Thanks

Link to comment
Share on other sites

Your content item must implement \IPS\Content\Embeddable.

That alone will make your content embeddable from the editor. If you want to customize the layout of the embedded content, you can add the following 2 methods to your class:

/**
	 * Get content for embed
	 *
	 * @param	array	$params	Additional parameters to add to URL
	 * @return	string
	 */
	public function embedContent( $params )
	{
		return \IPS\Theme::i()->getTemplate( 'global', 'core' )->embedItem( $this, $this->url()->setQueryString( $params ), $this->embedImage() );
	}
	
	/**
	 * Get image for embed
	 *
	 * @return	\IPS\File|NULL
	 */
	public function embedImage()
	{
		return NULL;
	}

The only one you would really need is embedContent, though.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...