Skip to content

Commit 8e16e7e

Browse files
committed
WIP3
1 parent e152bf2 commit 8e16e7e

File tree

3 files changed

+25
-10
lines changed

3 files changed

+25
-10
lines changed

application/controllers/EventRuleController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,10 @@ public function indexAction(): void
8686
->on(EventRuleConfigForm::ON_DISCARD, function () use ($config) {
8787
$ruleId = $config['id'];
8888
$this->sessionNamespace->delete($ruleId);
89+
Notification::success(sprintf(t('Successfully discarded changes to event rule %s'), $config['name']));
8990
$this->redirectNow(Links::eventRule($ruleId));
9091
})
9192
->on(EventRuleConfigForm::ON_CHANGE, function (EventRuleConfigForm $form) use ($config) {
92-
$formValues = $form->getValues();
9393
$config = array_merge($config, $form->getValues());
9494
$this->sessionNamespace->set($config['id'], $config);
9595
})

application/forms/EventRuleConfigElements/EventRuleConfigFilter.php

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,10 @@
1313

1414
class EventRuleConfigFilter extends FieldsetElement
1515
{
16-
/** @var bool */
17-
public $showSearchBar = false;
18-
19-
/** @var Url The url to open the SearchEditor at */
16+
/** @var Url Url of the search editor */
2017
protected $searchEditorUrl;
2118

22-
/** @var ?string */
19+
/** @var ?string Event rule's object filter*/
2320
protected $objectFilter;
2421

2522
protected $defaultAttributes = ['class' => 'config-filter'];
@@ -57,7 +54,7 @@ protected function assemble()
5754
} else {
5855
$editorOpener = new Link(
5956
new Icon('cog'),
60-
$this->searchEditorUrl,
57+
$this->getSearchEditorUrl(),
6158
Attributes::create([
6259
'class' => 'search-editor-opener control-button',
6360
'title' => t('Adjust Filter'),
@@ -82,31 +79,50 @@ protected function assemble()
8279
$this->add($filterElement);
8380
}
8481

82+
/**
83+
* Set the Url of the search editor
84+
*
85+
* @param Url $url
86+
*
87+
* @return $this
88+
*/
8589
public function setSearchEditorUrl(Url $url)
8690
{
8791
$this->searchEditorUrl = $url;
8892

8993
return $this;
9094
}
9195

96+
/**
97+
* Get the search editor's Url
98+
*
99+
* @return Url
100+
*/
92101
public function getSearchEditorUrl()
93102
{
94103
return $this->searchEditorUrl;
95104
}
96105

97106
/**
107+
* Set the event rule's object filter
108+
*
98109
* @param string $filter
99110
*
100111
* @return $this
101112
*/
102-
public function setObjectFilter(string $filter)
113+
public function setObjectFilter(string $filter): self
103114
{
104115
$this->objectFilter = rawurldecode($filter);
105116

106117
return $this;
107118
}
108119

109-
public function getObjectFilter()
120+
/**
121+
* Get the event rule's object filter
122+
*
123+
* @return ?string
124+
*/
125+
public function getObjectFilter(): ?string
110126
{
111127
return $this->objectFilter;
112128
}

application/forms/EventRuleConfigForm.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,6 @@ protected function assemble()
163163
for ($i = 1; $i <= $escalationCount; $i++) {
164164
$escalationCondition = new EscalationCondition('escalation-condition_' . $i);
165165
$escalationRecipient = new EscalationRecipient('escalation-recipient_' . $i);
166-
167166
$this->registerElement($escalationCondition);
168167
$this->registerElement($escalationRecipient);
169168

0 commit comments

Comments
 (0)