Skip to content

Commit 029d0e6

Browse files
🔃 [EngCom] Public Pull Requests - 2.2-develop
Accepted Public Pull Requests: - #15067: fixed documentation about viewModels. The key in xml should be view_m� (by @Jakhotiya) - #14967: Format the javascript code (by @yogeshks)
2 parents 5ed3aa3 + 1b4d8d8 commit 029d0e6

File tree

3 files changed

+28
-11
lines changed

3 files changed

+28
-11
lines changed

app/code/Magento/Backend/Block/Template.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,12 @@
1717
* Example:
1818
* <block name="my.block" class="Magento\Backend\Block\Template" template="My_Module::template.phtml" >
1919
* <arguments>
20-
* <argument name="viewModel" xsi:type="object">My\Module\ViewModel\Custom</argument>
20+
* <argument name="view_model" xsi:type="object">My\Module\ViewModel\Custom</argument>
2121
* </arguments>
2222
* </block>
2323
*
24+
* Your class object can then be accessed by doing $block->getViewModel()
25+
*
2426
* @api
2527
* @SuppressWarnings(PHPMD.NumberOfChildren)
2628
* @since 100.0.2

app/code/Magento/Ui/view/base/templates/control/button/split.phtml

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
</button>
1818
<?php if ($block->hasSplit()): ?>
1919
<button <?= $block->getToggleAttributesHtml() ?>>
20-
<span>Select</span>
20+
<span><?= /* @escapeNotVerified */ __('Select'); ?></span>
2121
</button>
2222

2323
<?php if (!$block->getDisabled()): ?>
@@ -40,12 +40,10 @@
4040
<?php endif; ?>
4141
<?php endif; ?>
4242
</div>
43-
44-
<script>
45-
require(['jquery'], function($){
46-
$('.actions-split')
47-
.on('click.splitDefault', '.action-default', function() {
48-
$(this).siblings('.dropdown-menu').find('.item-default').trigger('click');
49-
});
50-
});
51-
</script>
43+
<script type="text/x-magento-init">
44+
{
45+
".actions-split": {
46+
"Magento_Ui/js/grid/controls/button/split": {}
47+
}
48+
}
49+
</script>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/**
2+
* Copyright © Magento, Inc. All rights reserved.
3+
* See COPYING.txt for license details.
4+
*/
5+
6+
define([
7+
'jquery'
8+
], function ($) {
9+
'use strict';
10+
11+
return function (data, element) {
12+
13+
$(element).on('click.splitDefault', '.action-default', function () {
14+
$(this).siblings('.dropdown-menu').find('.item-default').trigger('click');
15+
});
16+
};
17+
});

0 commit comments

Comments
 (0)