function entity_embed_command_open_dialog in Entity Embed 7
Creates a Drupal Ajax 'open dialog' command.
Parameters
string $selector: The selector of the dialog.
string $title: The title of the dialog.
string|array $content: The content that will be placed in the dialog, either a render array or an HTML string.
array $dialog_options: (optional) Options to be passed to the dialog implementation. Any jQuery UI option can be used. See http://api.jqueryui.com/dialog.
array|null $settings: (optional) Custom settings that will be passed to the Drupal behaviors on the content of the dialog. If left empty, the settings will be populated automatically from the current request.
Return value
An array suitable for use with the ajax_render() function.
File
- includes/
entity_embed.commands.inc, line 82 - AJAX commands.
Code
function entity_embed_command_open_dialog($selector, $title, $content, array $dialog_options = array(), $settings = NULL) {
$dialog_options += array(
'title' => $title,
);
if (is_array($content)) {
$html = drupal_render($content);
$content = $html;
}
// For consistency ensure the modal option is set to TRUE or FALSE.
$dialog_options['modal'] = isset($dialog_options['modal']) && $dialog_options['modal'];
return array(
'command' => 'openDialog',
'selector' => $selector,
'settings' => $settings,
'data' => $content,
'dialogOptions' => $dialog_options,
);
}