2 * @file entity_browser.iframe.js
4 * Defines the behavior of the entity browser's iFrame display.
7 (function ($, Drupal, drupalSettings) {
12 * Registers behaviours related to iFrame display.
14 Drupal.behaviors.entityBrowserIFrame = {
15 attach: function (context) {
16 $(context).find('.entity-browser-handle.entity-browser-iframe').once('iframe-click').on('click', Drupal.entityBrowserIFrame.linkClick);
17 $(context).find('.entity-browser-handle.entity-browser-iframe').once('iframe-auto-open').each(function () {
18 var uuid = $(this).attr('data-uuid');
19 if (drupalSettings.entity_browser.iframe[uuid].auto_open) {
26 Drupal.entityBrowserIFrame = {};
29 * Handles click on "Select entities" link.
31 Drupal.entityBrowserIFrame.linkClick = function () {
32 var uuid = $(this).attr('data-uuid');
33 var original_path = $(this).attr('data-original-path');
34 var iframeSettings = drupalSettings['entity_browser']['iframe'][uuid];
38 'src': iframeSettings['src'],
40 'height': iframeSettings['height'],
42 'data-original-path': original_path,
43 'name': 'entity_browser_iframe_' + iframeSettings['entity_browser_id'],
44 'id': 'entity_browser_iframe_' + iframeSettings['entity_browser_id']
48 var throbber = $('<div class="ajax-progress-fullscreen"></div>');
49 $(this).parent().css('width', iframeSettings['width']);
51 // Register callbacks.
52 if (drupalSettings.entity_browser.iframe[uuid].js_callbacks || false) {
53 Drupal.entityBrowser.registerJsCallbacks(this, drupalSettings.entity_browser.iframe[uuid].js_callbacks, 'entities-selected');
56 $(this).parent().append(throbber).append(iframe).trigger('entityBrowserIFrameAppend');
60 }(jQuery, Drupal, drupalSettings));