Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0).
### Fixed

- Throwable: Stub index points to a file without PSI [#1232](https://github.com/magento/magento2-phpstorm-plugin/pull/1232)
- Create an entity - delete button is displayed in a new entity form [#1268](https://github.com/magento/magento2-phpstorm-plugin/pull/1268)

## 5.0.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ class ${NAME} extends ${GENERIC_BUTTON} implements ${DATA_PROVIDER_TYPE}
*/
public function getButtonData(): array
{
#if (${GET_ID})
if (!$this->${GET_ID}) {
return [];
}

#end
return $this->wrapButtonSettings(
'${LABEL}',
'${CLASS}',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,9 @@ protected void fillAttributes(final @NotNull Properties attributes) {
attributes.setProperty("SORT_ORDER", String.valueOf(buttonTypeSettings.getSortOrder()));
attributes.setProperty("ENTITY_NAME", Strings.toLowerCase(entityName));
attributes.setProperty("ENTITY_ID", entityIdField);
if (buttonData.getButtonType().equals(FormButtonBlockFile.TYPE_DELETE)) {
attributes.setProperty("GET_ID", entityIdAccessor);
}

attributes.setProperty("USES", PhpClassGeneratorUtil.formatUses(uses));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ class DeleteBlock extends GenericButton implements ButtonProviderInterface
*/
public function getButtonData(): array
{
if (!$this->getBookId()) {
return [];
}

return $this->wrapButtonSettings(
'Delete',
'delete',
Expand Down