aboutsummaryrefslogtreecommitdiff
path: root/mod/embed/README.txt
blob: c7ce2e5281e99e5397c542c34c42f8ad9414f46d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
Embed plugin

CONTENTS:
	1. Overview
	2. Adding a Tab
	3. Populating a Select Tab
	4. Populating an Upload Tab
	5. Other WYSIWYG Editors and Embed

	
1. Overview
	The Embed plugin is a simple way to allow users to link to or embed
	their personal network content or third party resources in any text area.

	The Embed plugin adds a menu item to the longtext menu. Clicking on this
	link pops up a lightbox. The lightbox has two types of tabs: one for
	selecting content to embed and one for uploading new content.

2. Adding a Tab
	The Embed plugin uses the menu system to manage its tabs. Use
	elgg_register_menu_item() for the embed menu to add a new tab like this:

	$item = ElggMenuItem::factory(array(
		'name' => 'file',
		'text' => elgg_echo('file'),
		'section' => 'select',
		'data' => array(
			'options' => array(
				'type' => 'object',
				'subtype' => 'file',
			),
		),
	));
	elgg_register_menu_item('embed', $item);

	Parameters:
		name: The unique name of the tab.
		text: The text shown on the tab
		section: 'select' for embed selection or 'upload' for uploading new content
		data: an array of parameters for creating the tab and its content. See
			the two sections below for data key values for the two tab types.

	Select tab data parameters:
		options: array of options passed to elgg_list_entities()

	Upload tab data parameters:
		view: the view used to render the tab content

	See the file plugin for examples of registering both tab types.


3. Populating a Select Tab
	Nothing should be required other than setting the options parameter array
	when registering the tab. See the view embed/item to see how an entity is
	rendered.

4. Populating an Upload Tab
	The view that is registered must be defined. It must include a form for
	uploading the content. The form must be wrapped in a div with the class
	.embed-upload. Somewhere in the view must be a hidden input field with the
	name embed_hidden with its value be the name of the tab to forward the user
	to when uploading is complete.

	See the view embed/file_upload/content for an example
	
5. Other WYSIWYG Editors and Embed
	Embed ships with support for the default input/longtext textarea.
	Plugins replacing this view are expected to include JaVascript to
	allow embed to work with the new editors.
	
	To add custom JavaScript into the Embed plugin's elgg.embed.insert() function,
	override the view embed/custom_insert_js. The textarea jQuery object is
	available as the variable textArea and the content to be inserted is the
	variable content. See the TinyMCE plugin for an example of this view.