Skip to content

Commit

Permalink
#2799361 - Create rules_and and rules_or condition sets (expressions)…
Browse files Browse the repository at this point in the history
… in the UI.
  • Loading branch information
Daniel Sasser committed Oct 4, 2016
1 parent d58ca75 commit ef2f28c
Show file tree
Hide file tree
Showing 4 changed files with 323 additions and 95 deletions.
2 changes: 1 addition & 1 deletion src/Form/EditExpressionForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function buildForm(array $form, FormStateInterface $form_state, RulesUiHa
throw new NotFoundHttpException();
}
$form_handler = $expression->getFormHandler();
$form = $form_handler->form($form, $form_state);
$form = $form_handler->form($form, $form_state, ['init' => TRUE]);
return $form;
}

Expand Down
8 changes: 4 additions & 4 deletions src/Form/Expression/ActionContainerForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ public function __construct(ActionExpressionContainerInterface $action_set) {
* {@inheritdoc}
*/
public function form(array $form, FormStateInterface $form_state) {
$form['action_table'] = [
$form['action_table_container'] = [
'#type' => 'container',
];

$form['action_table']['table'] = [
$form['action_table_container']['action_table'] = [
'#type' => 'table',
'#header' => [
$this->t('Elements'),
Expand Down Expand Up @@ -75,7 +75,7 @@ public function form(array $form, FormStateInterface $form_state) {
foreach ($actions as $action) {
/* @var $action \Drupal\rules\Engine\ExpressionInterface */
$uuid = $action->getUuid();
$row = &$form['action_table']['table'][$uuid];
$row = &$form['action_table_container']['action_table'][$uuid];

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

0 comments on commit ef2f28c

Please sign in to comment.