/**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     $component = $this->rulesUiHandler->getComponent();
     $component->getExpression()->deleteExpression($this->uuid);
     $this->rulesUiHandler->updateComponent($component);
     $form_state->setRedirectUrl($this->getCancelUrl());
 }
Exemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function buildForm(array $form, FormStateInterface $form_state, RulesUiHandlerInterface $rules_ui_handler = NULL, $uuid = NULL, $expression_id = NULL)
 {
     $this->expressionId = $expression_id;
     $this->uuid = $uuid;
     // When initially adding the expression, we have to initialize the object
     // and add the expression.
     if (!$this->uuid) {
         // Before we add our edited expression to the component's expression,
         // we clone it such that we do not change the source component until
         // the form has been successfully submitted.
         $component = clone $rules_ui_handler->getComponent();
         $this->uuid = $this->getEditedExpression($component)->getUuid();
         $form_state->set('component', $component);
         $form_state->set('uuid', $this->uuid);
     }
     return parent::buildForm($form, $form_state, $rules_ui_handler, $this->uuid);
 }
 /**
  * {@inheritdoc}
  */
 public function validateForm(array &$form, FormStateInterface $form_state)
 {
     $this->rulesUiHandler->validateLock($form, $form_state);
     $this->getFormHandler()->validateForm($form, $form_state);
 }
Exemplo n.º 4
0
 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     $this->rulesUiHandler->clearTemporaryStorage();
     $form_state->setRedirectUrl($this->rulesUiHandler->getBaseRouteUrl());
     drupal_set_message($this->t('The lock has been broken and you may now edit this @component_type.', ['@component_type' => $this->rulesUiHandler->getPluginDefinition()->component_type_label]));
 }
Exemplo n.º 5
0
 /**
  * Provides the page title on the form.
  */
 public function getTitle(RulesUiHandlerInterface $rules_ui_handler, $uuid)
 {
     $this->uuid = $uuid;
     $expression = $this->getEditedExpression($rules_ui_handler->getComponent());
     return $this->t('Edit @expression', ['@expression' => $expression->getLabel()]);
 }