function entity_embed_preview in Entity Embed 7.2
Same name and namespace in other branches
- 7.3 entity_embed.module \entity_embed_preview()
- 7 entity_embed.module \entity_embed_preview()
Returns an Ajax response to generate preview of an entity.
Expects the the HTML element as GET parameter.
Parameters
$filter_format: The filter format.
Return value
The Ajax response.
1 string reference to 'entity_embed_preview'
- entity_embed_menu in ./
entity_embed.module - Implements hook_menu().
File
- ./
entity_embed.module, line 339 - Provides a CKEditor plugin and text filter for embedding and rendering entities.
Code
function entity_embed_preview($filter_format) {
$query_parameters = drupal_get_query_parameters();
$text = $query_parameters['value'];
if ($text == '') {
drupal_exit();
}
// @todo: remove contextual links.
$entity_output = check_markup($text, $filter_format->format);
$commands[] = entity_embed_command_insert($entity_output);
return array(
'#type' => 'ajax',
'#commands' => $commands,
);
}