Skip to content

Commit 4655cb7

Browse files
author
Vitaliy Boyko
committed
89: added button and fieldset
1 parent af86b5d commit 4655cb7

32 files changed

+1799
-490
lines changed

resources/META-INF/plugin.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
<action id="MagentoCreateAGraphQlResolver" class="com.magento.idea.magento2plugin.actions.generation.NewGraphQlResolverAction" />
6767
<action id="MagentoCreateCLICommand" class="com.magento.idea.magento2plugin.actions.generation.NewCLICommandAction" />
6868
<action id="MagentoCreateUiComponentGrid" class="com.magento.idea.magento2plugin.actions.generation.NewUiComponentGridAction" />
69+
<action id="MagentoCreateUiComponentForm" class="com.magento.idea.magento2plugin.actions.generation.NewUiComponentFormAction" />
6970
<add-to-group group-id="NewGroup" anchor="last"/>
7071
</group>
7172

@@ -203,6 +204,8 @@
203204
<internalFileTemplate name="Magento Module UI Component Grid Xml"/>
204205
<internalFileTemplate name="Magento Module Ui Grid Collection Data Provider Php"/>
205206
<internalFileTemplate name="Magento Module Ui Grid Custom Data Provider Php"/>
207+
<internalFileTemplate name="Magento Module UI Component Form Xml"/>
208+
<internalFileTemplate name="Magento Php Form Button Block Class"/>
206209

207210
<postStartupActivity implementation="com.magento.idea.magento2plugin.project.startup.CheckIfMagentoPathIsValidActivity"/>
208211
</extensions>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
return [
2+
'label' => __('${BUTTON_LABEL}'),
3+
'on_click' => sprintf("location.href = '%s';", $this->getUrl('*/*/')),
4+
'class' => 'back',
5+
'sort_order' => ${BUTTON_SORT_ORDER}
6+
];
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
return [
2+
'label' => __('${BUTTON_LABEL}'),
3+
'class' => 'delete',
4+
'on_click' => 'deleteConfirm(\'' . __(
5+
'Are you sure you want to do this?'
6+
) . '\', \'' .
7+
//TODO: adjust entity ID
8+
$this->getUrl('*/*/${BUTTON_ROUTE}', ['entity_id' => ''])
9+
. '\', {"data": {}})',
10+
'sort_order' => ${BUTTON_SORT_ORDER}
11+
];
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
return [
2+
'label' => __('${BUTTON_LABEL}'),
3+
'class' => 'save primary',
4+
'on_click' => '',
5+
'data_attribute' => [
6+
'mage-init' => [
7+
'Magento_Ui/js/form/button-adapter' => [
8+
'actions' => [
9+
[
10+
'targetName' => '${FORM_NAME}.${FORM_NAME}',
11+
'actionName' => 'save',
12+
'params' => [
13+
true,
14+
//TODO: adjust entity ID
15+
['entity_id' => ''],
16+
]
17+
]
18+
]
19+
]
20+
]
21+
]
22+
];
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?xml version="1.0"?>
2+
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
3+
<argument name="data" xsi:type="array">
4+
<item name="js_config" xsi:type="array">
5+
<item name="provider" xsi:type="string">${NAME}.${NAME}_data_source</item>
6+
</item>
7+
<item name="label" xsi:type="string" translate="true">${LABEL}</item>
8+
</argument>
9+
<settings>
10+
<namespace>${NAME}</namespace>
11+
<deps>
12+
<dep>${NAME}.${NAME}_data_source</dep>
13+
</deps>
14+
#if (${BUTTONS})
15+
<buttons>
16+
</buttons>
17+
#end
18+
</settings>
19+
<dataSource name="${NAME}_data_source" component="Magento_Ui/js/form/provider">
20+
<settings>
21+
<submitUrl path="customerquote/CustomerQuoteVersion/save"/>
22+
</settings>
23+
<dataProvider class="Atwix\CustomerQuotes\Ui\Component\CustomerQuoteVersion\Form\DataProvider\CustomerQuoteVersionDataProvider" name="${NAME}_data_source"/>
24+
</dataSource>
25+
26+
</form>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<!--
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
-->
7+
<html lang="en">
8+
<body>
9+
<p face="verdana" size="-1">
10+
The <a href="https://devdocs.magento.com/guides/v2.3/ui_comp_guide/components/ui-listing-grid.html">Form component</a> configuration.
11+
</p>
12+
13+
<table width="100%" border="0" cellpadding="5" cellspacing="0" style="border-collapse: collapse">
14+
<tr>
15+
<td colspan="3"><font face="verdana" size="-1">Template's predefined variables:</font></td>
16+
</tr>
17+
</table>
18+
</body>
19+
</html>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
#parse("PHP File Header.php")
3+
4+
#if (${NAMESPACE})
5+
6+
namespace ${NAMESPACE};
7+
8+
#end
9+
use Magento\Framework\View\Element\UiComponent\Control\ButtonProviderInterface;
10+
11+
/**
12+
* @inheritdoc
13+
*/
14+
class ${NAME} implements ButtonProviderInterface
15+
{
16+
/**
17+
* @inheritDoc
18+
*/
19+
public function getButtonData()
20+
{
21+
}
22+
}

0 commit comments

Comments
 (0)