b671405c8c38305b1b5c30aa0686e101af56f000
[yaffs-website] / web / modules / contrib / entity_browser / modules / entity_form / js / entity_browser_entity_form.js
1 /**
2  * @file entity_browser_entity_form.js
3  *
4  * Provides JS part of entity browser integration with IEF "use existing entity" feature.
5  */
6
7 (function ($, Drupal, drupalSettings) {
8
9   'use strict';
10
11   /**
12    * Registers behaviours related to IEF "use existing" feature.
13    */
14   Drupal.behaviors.entityBrowserEntityForm = {
15     attach: function (context) {
16       $(context).find('.eb-target').once('ief-entity-browser-value').on('entity_browser_value_updated', Drupal.entityBrowserEntityForm.valuesUpdated);
17     }
18   };
19
20   Drupal.entityBrowserEntityForm = {};
21
22   /**
23    * Reacts on entities being selected via entity form.
24    */
25   Drupal.entityBrowserEntityForm.valuesUpdated = function () {
26     $(this).parent().find('.ief-entity-submit').trigger('entities-selected');
27   };
28
29 }(jQuery, Drupal, drupalSettings));