Skip to content

Commit c1e4987

Browse files
Change all delete occurrences to remove to maintain consistency
- Form button name and labels - From success message - Some variable name and code comment
1 parent 364c47d commit c1e4987

File tree

6 files changed

+27
-27
lines changed

6 files changed

+27
-27
lines changed

application/controllers/ChannelController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ public function indexAction(): void
2222
$form = (new ChannelForm(Database::get()))
2323
->loadChannel($channelId)
2424
->on(ChannelForm::ON_SUCCESS, function (ChannelForm $form) {
25-
if ($form->getPressedSubmitElement()->getName() === 'delete') {
25+
if ($form->getPressedSubmitElement()->getName() === 'remove') {
2626
$form->removeChannel();
2727
Notification::success(sprintf(
28-
t('Deleted channel "%s" successfully'),
28+
t('Removed channel "%s" successfully'),
2929
$form->getValue('name')
3030
));
3131
} else {

application/controllers/ContactController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function indexAction(): void
3737
})->on(ContactForm::ON_REMOVE, function (ContactForm $form) {
3838
$form->removeContact();
3939
Notification::success(sprintf(
40-
t('Deleted contact "%s" successfully'),
40+
t('Removed contact "%s" successfully'),
4141
$form->getContactName()
4242
));
4343

application/controllers/SourceController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ public function indexAction(): void
2828
->on(SourceForm::ON_SUCCESS, function (SourceForm $form) {
2929
/** @var FormSubmitElement $pressedButton */
3030
$pressedButton = $form->getPressedSubmitElement();
31-
if ($pressedButton->getName() === 'delete') {
31+
if ($pressedButton->getName() === 'remove') {
3232
$form->removeSource();
3333
Notification::success(sprintf(
34-
$this->translate('Deleted source "%s" successfully'),
34+
$this->translate('Removed source "%s" successfully'),
3535
$form->getSourceName()
3636
));
3737
} else {

application/forms/ChannelForm.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,12 @@ protected function assemble()
126126
->first();
127127
}
128128

129-
/** @var FormSubmitElement $deleteButton */
130-
$deleteButton = $this->createElement(
129+
/** @var FormSubmitElement $removeButton */
130+
$removeButton = $this->createElement(
131131
'submit',
132-
'delete',
132+
'remove',
133133
[
134-
'label' => $this->translate('Delete'),
134+
'label' => $this->translate('Remove'),
135135
'class' => 'btn-remove',
136136
'formnovalidate' => true,
137137
'disabled' => $isInUse !== null,
@@ -144,16 +144,16 @@ protected function assemble()
144144
]
145145
);
146146

147-
$this->registerElement($deleteButton);
147+
$this->registerElement($removeButton);
148148
$this->getElement('submit')
149149
->getWrapper()
150-
->prepend($deleteButton);
150+
->prepend($removeButton);
151151
}
152152
}
153153

154154
public function isValid()
155155
{
156-
if ($this->getPressedSubmitElement()->getName() === 'delete') {
156+
if ($this->getPressedSubmitElement()->getName() === 'remove') {
157157
$csrfElement = $this->getElement('CSRFToken');
158158

159159
if (! $csrfElement->isValid()) {
@@ -168,7 +168,7 @@ public function isValid()
168168

169169
public function hasBeenSubmitted()
170170
{
171-
if ($this->getPressedSubmitElement() !== null && $this->getPressedSubmitElement()->getName() === 'delete') {
171+
if ($this->getPressedSubmitElement() !== null && $this->getPressedSubmitElement()->getName() === 'remove') {
172172
return true;
173173
}
174174

application/forms/SourceForm.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -220,22 +220,22 @@ protected function assemble(): void
220220
);
221221

222222
if ($this->sourceId !== null) {
223-
/** @var FormSubmitElement $deleteButton */
224-
$deleteButton = $this->createElement(
223+
/** @var FormSubmitElement $removeButton */
224+
$removeButton = $this->createElement(
225225
'submit',
226-
'delete',
226+
'remove',
227227
[
228-
'label' => $this->translate('Delete'),
228+
'label' => $this->translate('Remove'),
229229
'class' => 'btn-remove',
230230
'formnovalidate' => true
231231
]
232232
);
233233

234-
$this->registerElement($deleteButton);
234+
$this->registerElement($removeButton);
235235

236236
/** @var BaseHtmlElement $submitWrapper */
237237
$submitWrapper = $this->getElement('save')->getWrapper();
238-
$submitWrapper->prepend($deleteButton);
238+
$submitWrapper->prepend($removeButton);
239239
}
240240
}
241241

library/Notifications/Web/Form/ContactForm.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class ContactForm extends CompatForm
2626
{
2727
use CsrfCounterMeasure;
2828

29-
/** @var string Emitted in case the contact should be deleted */
29+
/** @var string Emitted in case the contact should be removed */
3030
public const ON_REMOVE = 'on_remove';
3131

3232
/** @var Connection */
@@ -56,7 +56,7 @@ private function hasBeenRemoved(): bool
5656
$btn = $this->getPressedSubmitElement();
5757
$csrf = $this->getElement('CSRFToken');
5858

59-
return $csrf !== null && $csrf->isValid() && $btn !== null && $btn->getName() === 'delete';
59+
return $csrf !== null && $csrf->isValid() && $btn !== null && $btn->getName() === 'remove';
6060
}
6161

6262
public function isValidEvent($event)
@@ -141,21 +141,21 @@ protected function assemble()
141141
]
142142
);
143143
if ($this->contactId !== null) {
144-
/** @var FormSubmitElement $deleteButton */
145-
$deleteButton = $this->createElement(
144+
/** @var FormSubmitElement $removeButton */
145+
$removeButton = $this->createElement(
146146
'submit',
147-
'delete',
147+
'remove',
148148
[
149-
'label' => $this->translate('Delete'),
149+
'label' => $this->translate('Remove'),
150150
'class' => 'btn-remove',
151151
'formnovalidate' => true
152152
]
153153
);
154154

155-
$this->registerElement($deleteButton);
155+
$this->registerElement($removeButton);
156156
$this->getElement('submit')
157157
->getWrapper()
158-
->prepend($deleteButton);
158+
->prepend($removeButton);
159159
}
160160
}
161161

0 commit comments

Comments
 (0)