2015-06-05 20:17:55 +00:00
|
|
|
/**
|
2017-05-19 22:12:53 +00:00
|
|
|
* DO NOT EDIT THIS FILE.
|
|
|
|
* See the following change record for more information,
|
2017-05-23 14:30:14 +00:00
|
|
|
* https://www.drupal.org/node/2815083
|
2017-05-19 22:12:53 +00:00
|
|
|
* @preserve
|
|
|
|
**/
|
2015-06-05 20:17:55 +00:00
|
|
|
|
2016-02-29 03:25:57 +00:00
|
|
|
(function ($, Drupal) {
|
2014-04-13 19:04:02 +00:00
|
|
|
Drupal.behaviors.menuUiDetailsSummaries = {
|
2017-05-19 22:12:53 +00:00
|
|
|
attach: function attach(context) {
|
2014-01-27 21:41:32 +00:00
|
|
|
$(context).find('.menu-link-form').drupalSetSummary(function (context) {
|
|
|
|
var $context = $(context);
|
2020-01-30 09:08:38 +00:00
|
|
|
|
2015-09-20 16:57:36 +00:00
|
|
|
if ($context.find('.js-form-item-menu-enabled input').is(':checked')) {
|
|
|
|
return Drupal.checkPlain($context.find('.js-form-item-menu-title input').val());
|
2010-11-05 19:47:20 +00:00
|
|
|
}
|
2017-07-06 06:21:40 +00:00
|
|
|
|
|
|
|
return Drupal.t('Not in menu');
|
2010-11-05 19:47:20 +00:00
|
|
|
});
|
2014-01-27 21:41:32 +00:00
|
|
|
}
|
|
|
|
};
|
2014-04-13 19:04:02 +00:00
|
|
|
Drupal.behaviors.menuUiLinkAutomaticTitle = {
|
2017-05-19 22:12:53 +00:00
|
|
|
attach: function attach(context) {
|
2014-01-27 21:41:32 +00:00
|
|
|
var $context = $(context);
|
|
|
|
$context.find('.menu-link-form').each(function () {
|
|
|
|
var $this = $(this);
|
2015-09-20 16:57:36 +00:00
|
|
|
var $checkbox = $this.find('.js-form-item-menu-enabled input');
|
2017-12-03 16:02:05 +00:00
|
|
|
var $linkTitle = $context.find('.js-form-item-menu-title input');
|
2015-09-20 16:57:36 +00:00
|
|
|
var $title = $this.closest('form').find('.js-form-item-title-0-value input');
|
2017-05-19 22:12:53 +00:00
|
|
|
|
2017-12-03 16:02:05 +00:00
|
|
|
if (!($checkbox.length && $linkTitle.length && $title.length)) {
|
2014-01-27 21:41:32 +00:00
|
|
|
return;
|
|
|
|
}
|
2017-05-19 22:12:53 +00:00
|
|
|
|
2017-12-03 16:02:05 +00:00
|
|
|
if ($checkbox.is(':checked') && $linkTitle.val().length) {
|
|
|
|
$linkTitle.data('menuLinkAutomaticTitleOverridden', true);
|
2010-11-05 19:47:20 +00:00
|
|
|
}
|
2017-05-19 22:12:53 +00:00
|
|
|
|
2017-12-03 16:02:05 +00:00
|
|
|
$linkTitle.on('keyup', function () {
|
|
|
|
$linkTitle.data('menuLinkAutomaticTitleOverridden', true);
|
2014-01-27 21:41:32 +00:00
|
|
|
});
|
|
|
|
$checkbox.on('change', function () {
|
|
|
|
if ($checkbox.is(':checked')) {
|
2017-12-03 16:02:05 +00:00
|
|
|
if (!$linkTitle.data('menuLinkAutomaticTitleOverridden')) {
|
|
|
|
$linkTitle.val($title.val());
|
2014-01-27 21:41:32 +00:00
|
|
|
}
|
2017-05-19 22:12:53 +00:00
|
|
|
} else {
|
2017-12-03 16:02:05 +00:00
|
|
|
$linkTitle.val('');
|
|
|
|
$linkTitle.removeData('menuLinkAutomaticTitleOverridden');
|
2014-01-27 21:41:32 +00:00
|
|
|
}
|
2020-01-30 09:08:38 +00:00
|
|
|
|
2014-01-27 21:41:32 +00:00
|
|
|
$checkbox.closest('.vertical-tabs-pane').trigger('summaryUpdated');
|
|
|
|
$checkbox.trigger('formUpdated');
|
|
|
|
});
|
|
|
|
$title.on('keyup', function () {
|
2017-12-03 16:02:05 +00:00
|
|
|
if (!$linkTitle.data('menuLinkAutomaticTitleOverridden') && $checkbox.is(':checked')) {
|
|
|
|
$linkTitle.val($title.val());
|
|
|
|
$linkTitle.val($title.val()).trigger('formUpdated');
|
2014-01-27 21:41:32 +00:00
|
|
|
}
|
|
|
|
});
|
2010-11-05 19:47:20 +00:00
|
|
|
});
|
2014-01-27 21:41:32 +00:00
|
|
|
}
|
|
|
|
};
|
2017-05-19 22:12:53 +00:00
|
|
|
})(jQuery, Drupal);
|