Further modules included.
[yaffs-website] / web / modules / contrib / php / js / php.admin.js
1 /**
2  * @file
3  * PHP block behaviors.
4  */
5
6 (function ($) {
7
8   "use strict";
9
10   /**
11    * Provide the summary information for the block settings vertical tabs.
12    *
13    * @type {Drupal~behavior}
14    *
15    * @prop {Drupal~behaviorAttach} attach
16    *   Attaches the behavior for the block settings summaries.
17    */
18   Drupal.behaviors.phpSettingsSummary = {
19     attach: function () {
20       // The drupalSetSummary method required for this behavior is not available
21       // on the Blocks administration page, so we need to make sure this
22       // behavior is processed only if drupalSetSummary is defined.
23       if (typeof jQuery.fn.drupalSetSummary === 'undefined') {
24         return;
25       }
26
27       $('[data-drupal-selector="edit-visibility-php"]').drupalSetSummary(function (context) {
28         var $code = $(context).find('textarea[name="visibility[php][php]"]');
29         if ($code.val() === '<?php return TRUE; ?>') {
30           return Drupal.t('Not restricted');
31         }
32         else {
33           return Drupal.t('Restricted to certain pages');
34         }
35       });
36     }
37   };
38
39 })(jQuery);