Projet

Général

Profil

Paste
Télécharger (992 octets) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / panelizer / js / panelizer-entity-bundle.js @ 651307cd

1
/**
2
 * @file
3
 * This JavaScript provides Vertical Tabs integration with Panelizer so that the
4
 * tab displays a summary of what is enabled.
5
 */
6
(function ($) {
7
  'use strict';
8

    
9
Drupal.behaviors.panelizerFieldsetSummary = {
10
  attach: function (context) {
11
    $('fieldset.panelizer-entity-bundle', context).drupalSetSummary(function (context) {
12
      // Identify whether Panelizer is enabled.
13
      if ($('input#panelizer-status:checked', context).length === 0) {
14
        return Drupal.t('Not panelized');
15
      }
16

    
17
      // Indicate which view modes are panelized.
18
      var vals = [];
19
      $('input[name*="view modes"][name*=status]:checked', context).each(function () {
20
        vals.push(Drupal.t("@name: enabled", {'@name' : $(this).attr('title')}));
21
      });
22

    
23
      // The view modes might not actually be enabled.
24
      if (vals.length === 0) {
25
        return Drupal.t('No view modes enabled');
26
      }
27
      else {
28
        return vals.join('<br/>');
29
      }
30
    });
31
  }
32
};
33

    
34
})(jQuery);