Skip to content

Commit 8d3e893

Browse files
Improved buttons generation, test coverage changes
1 parent d1c65f3 commit 8d3e893

File tree

23 files changed

+512
-394
lines changed

23 files changed

+512
-394
lines changed

resources/fileTemplates/code/Magento Php Form Button Block Type Back.php.ft

Lines changed: 0 additions & 6 deletions
This file was deleted.

resources/fileTemplates/code/Magento Php Form Button Block Type Back.php.html

Lines changed: 0 additions & 1 deletion
This file was deleted.

resources/fileTemplates/code/Magento Php Form Button Block Type Delete.php.ft

Lines changed: 0 additions & 11 deletions
This file was deleted.

resources/fileTemplates/code/Magento Php Form Button Block Type Delete.php.html

Lines changed: 0 additions & 1 deletion
This file was deleted.

resources/fileTemplates/code/Magento Php Form Button Block Type Save.php.ft

Lines changed: 0 additions & 22 deletions
This file was deleted.

resources/fileTemplates/code/Magento Php Form Button Block Type Save.php.html

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,31 @@
11
<?php
22
#parse("PHP File Header.php")
33

4-
#if (${NAMESPACE})
5-
64
namespace ${NAMESPACE};
75

6+
#set($uses = ${USES})
7+
#foreach ($use in $uses.split(","))
8+
use $use;
89
#end
9-
use Magento\Framework\View\Element\UiComponent\Control\ButtonProviderInterface;
1010

1111
/**
12-
* @inheritdoc
12+
* ${CLASS_ANNOTATION}
1313
*/
14-
class ${NAME} implements ButtonProviderInterface
14+
class ${NAME} extends ${GENERIC_BUTTON} implements ${DATA_PROVIDER_TYPE}
1515
{
1616
/**
17-
* @inheritDoc
17+
* Retrieve ${TYPE} button settings.
18+
*
19+
* @return array
1820
*/
19-
public function getButtonData()
21+
public function getButtonData(): array
2022
{
23+
return $this->wrapButtonSettings(
24+
'${LABEL}',
25+
'${CLASS}',
26+
${ON_CLICK},
27+
${DATA_ATTRS},
28+
${SORT_ORDER}
29+
);
2130
}
2231
}

src/com/magento/idea/magento2plugin/actions/generation/dialog/NewEntityDialog.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,7 @@ protected List<UiComponentFormButtonData> getButtons() {
744744
directory,
745745
"Delete",
746746
getModuleName(),
747-
"Save",
747+
"Delete",
748748
namespaceBuilderDelete.getNamespace(),
749749
"Delete Entity",
750750
"30",
@@ -1235,7 +1235,7 @@ private void generateUiComponentFormFile() {
12351235
getEntityName(),
12361236
getSubmitActionName(),
12371237
getDataProviderNamespace().getClassFqn()
1238-
), project).generate(ACTION_NAME, true);
1238+
), project, getEntityName(), getEntityIdColumn()).generate(ACTION_NAME, true);
12391239
}
12401240

12411241
/**

src/com/magento/idea/magento2plugin/actions/generation/dialog/NewUiComponentFormDialog.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
import com.magento.idea.magento2plugin.actions.generation.generator.util.NamespaceBuilder;
4343
import com.magento.idea.magento2plugin.magento.files.ControllerBackendPhp;
4444
import com.magento.idea.magento2plugin.magento.files.ControllerFrontendPhp;
45-
import com.magento.idea.magento2plugin.magento.files.FormButtonBlockPhp;
45+
import com.magento.idea.magento2plugin.magento.files.FormButtonBlockFile;
4646
import com.magento.idea.magento2plugin.magento.files.ModuleMenuXml;
4747
import com.magento.idea.magento2plugin.magento.packages.Areas;
4848
import com.magento.idea.magento2plugin.magento.packages.File;
@@ -274,10 +274,10 @@ protected void initButtonsTable() {
274274
});
275275

276276
final String[] buttonTypes = {
277-
FormButtonBlockPhp.TYPE_SAVE,
278-
FormButtonBlockPhp.TYPE_BACK,
279-
FormButtonBlockPhp.TYPE_DELETE,
280-
FormButtonBlockPhp.TYPE_CUSTOM
277+
FormButtonBlockFile.TYPE_SAVE,
278+
FormButtonBlockFile.TYPE_BACK,
279+
FormButtonBlockFile.TYPE_DELETE,
280+
FormButtonBlockFile.TYPE_CUSTOM
281281
};
282282

283283
final TableColumn typeColumnObject = formButtons.getColumn(TYPE_COLUMN);

src/com/magento/idea/magento2plugin/actions/generation/generator/SaveEntityCommandGenerator.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import com.magento.idea.magento2plugin.magento.packages.code.FrameworkLibraryType;
2121
import com.magento.idea.magento2plugin.util.GetPhpClassByFQN;
2222
import java.util.ArrayList;
23-
import java.util.LinkedList;
2423
import java.util.List;
2524
import java.util.Properties;
2625
import org.jetbrains.annotations.NotNull;

0 commit comments

Comments
 (0)