X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fmodules%2Fcontrib%2Fphp%2Fjs%2Fphp.admin.js;fp=web%2Fmodules%2Fcontrib%2Fphp%2Fjs%2Fphp.admin.js;h=eac59159bb9e54969005814d7ed6d6379473cf13;hp=0000000000000000000000000000000000000000;hb=8acec36f19c470dfcda1ae2336826a782f41874c;hpb=e0411c4e83ba0d079034db83c3f7f55be24a0e35 diff --git a/web/modules/contrib/php/js/php.admin.js b/web/modules/contrib/php/js/php.admin.js new file mode 100644 index 000000000..eac59159b --- /dev/null +++ b/web/modules/contrib/php/js/php.admin.js @@ -0,0 +1,39 @@ +/** + * @file + * PHP block behaviors. + */ + +(function ($) { + + "use strict"; + + /** + * Provide the summary information for the block settings vertical tabs. + * + * @type {Drupal~behavior} + * + * @prop {Drupal~behaviorAttach} attach + * Attaches the behavior for the block settings summaries. + */ + Drupal.behaviors.phpSettingsSummary = { + attach: function () { + // The drupalSetSummary method required for this behavior is not available + // on the Blocks administration page, so we need to make sure this + // behavior is processed only if drupalSetSummary is defined. + if (typeof jQuery.fn.drupalSetSummary === 'undefined') { + return; + } + + $('[data-drupal-selector="edit-visibility-php"]').drupalSetSummary(function (context) { + var $code = $(context).find('textarea[name="visibility[php][php]"]'); + if ($code.val() === '') { + return Drupal.t('Not restricted'); + } + else { + return Drupal.t('Restricted to certain pages'); + } + }); + } + }; + +})(jQuery);