Beispiel #1
0
 /**
  * {@inheritdoc}
  */
 public function form(array $form, FormStateInterface $form_state)
 {
     $form['action_table'] = ['#type' => 'container'];
     $form['action_table']['table'] = ['#theme' => 'table', '#caption' => $this->t('Actions'), '#header' => [$this->t('Elements'), $this->t('Operations')], '#empty' => t('None')];
     foreach ($this->actionSet as $uuid => $action) {
         $form['action_table']['table']['#rows'][] = ['element' => $action->getLabel(), 'operations' => ['data' => ['#type' => 'dropbutton', '#links' => ['edit' => ['title' => $this->t('Edit'), 'url' => Url::fromRoute('rules.reaction_rule.expression.edit', ['reaction_config' => $this->actionSet->getRoot()->getConfigEntityId(), 'uuid' => $uuid])], 'delete' => ['title' => $this->t('Delete'), 'url' => Url::fromRoute('rules.reaction_rule.expression.delete', ['rules_reaction_rule' => $this->actionSet->getRoot()->getConfigEntityId(), 'uuid' => $uuid])]]]]];
     }
     // @todo Put this into the table as last row and style it like it was in
     // Drupal 7 Rules.
     $form['add_action'] = ['#theme' => 'menu_local_action', '#link' => ['title' => $this->t('Add action'), 'url' => Url::fromRoute('rules.reaction_rule.expression.add', ['reaction_config' => $this->actionSet->getRoot()->getConfigEntityId(), 'expression_id' => 'rules_action'])]];
     return $form;
 }
Beispiel #2
0
 /**
  * PHP magic __clone function.
  */
 public function __clone()
 {
     $this->actions = clone $this->actions;
     $this->actions->setRoot($this->getRoot());
     $this->conditions = clone $this->conditions;
     $this->conditions->setRoot($this->getRoot());
 }
Beispiel #3
0
 /**
  * {@inheritdoc}
  */
 public function getConfiguration()
 {
     $configuration = parent::getConfiguration();
     // We need to update the configuration in case actions/conditions have been
     // added or changed.
     $configuration['conditions'] = $this->conditions->getConfiguration();
     $configuration['actions'] = $this->actions->getConfiguration();
     return $configuration;
 }
Beispiel #4
0
 /**
  * {@inheritdoc}
  */
 public function checkIntegrity(ExecutionMetadataStateInterface $metadata_state)
 {
     $violation_list = $this->conditions->checkIntegrity($metadata_state);
     $violation_list->addAll($this->actions->checkIntegrity($metadata_state));
     return $violation_list;
 }