Extensible Object Embedding (e.g. YouTube)

Author: Victor Boctor

Introduction

This feature is to allow embedding of custom objects into Mantis. This will be shown in area like issue view page, news and others. An example of object that can be embedded is videos.

Syntax

The syntax to embed an object would be as follows:

[embed type=youtube]dgwbHzOec9I[/embed]

In the above example, “youtube” is the type of the object to embed and “dgwbHzOec9I” is the parameter(s).

How will it work?

The string_api.php will detect patterns like [embed type=sometype]param[/embed], will lower case the type and then call custom function “embed”. The default implementation for this custom function (custom_function_default_embed) will call the appropriate embed_<type>(param) method from core/embed_api.php.

The methods in embed API take a single parameter and return the replacement string.

How to define new types?

	function custom_function_override_embed( $p_type, $p_param ) {
		switch ( $p_type ) {
			case 'mytype':
				return "some output for type '$p_type' and param '$p_param'";
			default:
				return custom_function_default_embed( $p_type, $p_param );
		}
	}

Feedback

Please provide feedback in this section.

 
Logged in as: anonymous
mantisbt/extensible_object_embedding_requirements.txt · Last modified: 2008/10/29 04:25