You are here

function entity_embed_dialog in Entity Embed 7

Menu callback; Provide the dialog for embedding entities.

1 string reference to 'entity_embed_dialog'
entity_embed_menu in ./entity_embed.module
Implements hook_menu().

File

./entity_embed.admin.inc, line 11
Admin page callbacks for the entity_embed module.

Code

function entity_embed_dialog($filter_format, $embed_button) {
  $input = $_POST;
  $dialog_options = array();
  if (isset($input['dialog'])) {
    $dialog_options = $input['dialog'];
  }

  // Render the content.
  $form = drupal_get_form('entity_embed_dialog_form', $input, $filter_format, $embed_button);

  // Determine the title: use the title provided by the form if any, otherwise
  // get it from the menu item.
  $title = isset($form['#title']) ? $form['#title'] : drupal_get_title();
  $content = drupal_render($form);
  drupal_process_attached($form);
  $commands[] = entity_embed_command_open_modal_dialog($title, $content, $dialog_options);
  return array(
    '#type' => 'ajax',
    '#commands' => $commands,
  );
}