Skip to content

Commit ef2f28c

Browse files
author
Daniel Sasser
committed
#2799361 - Create rules_and and rules_or condition sets (expressions) in the UI.
1 parent d58ca75 commit ef2f28c

4 files changed

Lines changed: 323 additions & 95 deletions

File tree

src/Form/EditExpressionForm.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public function buildForm(array $form, FormStateInterface $form_state, RulesUiHa
6767
throw new NotFoundHttpException();
6868
}
6969
$form_handler = $expression->getFormHandler();
70-
$form = $form_handler->form($form, $form_state);
70+
$form = $form_handler->form($form, $form_state, ['init' => TRUE]);
7171
return $form;
7272
}
7373

src/Form/Expression/ActionContainerForm.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ public function __construct(ActionExpressionContainerInterface $action_set) {
3434
* {@inheritdoc}
3535
*/
3636
public function form(array $form, FormStateInterface $form_state) {
37-
$form['action_table'] = [
37+
$form['action_table_container'] = [
3838
'#type' => 'container',
3939
];
4040

41-
$form['action_table']['table'] = [
41+
$form['action_table_container']['action_table'] = [
4242
'#type' => 'table',
4343
'#header' => [
4444
$this->t('Elements'),
@@ -75,7 +75,7 @@ public function form(array $form, FormStateInterface $form_state) {
7575
foreach ($actions as $action) {
7676
/* @var $action \Drupal\rules\Engine\ExpressionInterface */
7777
$uuid = $action->getUuid();
78-
$row = &$form['action_table']['table'][$uuid];
78+
$row = &$form['action_table_container']['action_table'][$uuid];
7979

8080
// TableDrag: Mark the table row as draggable.
8181
$row['#attributes']['class'][] = 'draggable';
@@ -133,7 +133,7 @@ public function form(array $form, FormStateInterface $form_state) {
133133
* {@inheritdoc}
134134
*/
135135
public function submitForm(array &$form, FormStateInterface $form_state) {
136-
$values = $form_state->getValue('table');
136+
$values = $form_state->getValue('action_table');
137137
$component = $this->getRulesUiHandler()->getComponent();
138138
/* @var $rule_expression \Drupal\rules\Plugin\RulesExpression\Rule */
139139
$rule_expression = $component->getExpression();

0 commit comments

Comments
 (0)