class RuleExpressionForm

Form view structure for rule expressions.

Hierarchy

Expanded class hierarchy of RuleExpressionForm

See also

\Drupal\rules\Plugin\RulesExpression\RuleExpression

File

src/Form/Expression/RuleExpressionForm.php, line 13

Namespace

Drupal\rules\Form\Expression
View source
class RuleExpressionForm implements ExpressionFormInterface {
    use ExpressionFormTrait;
    
    /**
     * The rule expression object this form is for.
     *
     * @var \Drupal\rules\Engine\RuleExpressionInterface
     */
    protected $rule;
    
    /**
     * Creates a new object of this class.
     */
    public function __construct(RuleExpressionInterface $rule) {
        $this->rule = $rule;
    }
    
    /**
     * {@inheritdoc}
     */
    public function form(array $form, FormStateInterface $form_state) {
        $conditions_form_handler = $this->rule
            ->getConditions()
            ->getFormHandler();
        $form = $conditions_form_handler->form($form, $form_state);
        $actions_form_handler = $this->rule
            ->getActions()
            ->getFormHandler();
        $form = $actions_form_handler->form($form, $form_state);
        return $form;
    }
    
    /**
     * {@inheritdoc}
     */
    public function submitForm(array &$form, FormStateInterface $form_state) {
        $this->rule
            ->getConditions()
            ->getFormHandler()
            ->submitForm($form, $form_state);
        $this->rule
            ->getActions()
            ->getFormHandler()
            ->submitForm($form, $form_state);
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title
ExpressionFormTrait::validateForm public function Implements ExpressionFormInterface::validateForm().
RuleExpressionForm::$rule protected property The rule expression object this form is for.
RuleExpressionForm::form public function Adds elements specific to the expression to the form. Overrides ExpressionFormInterface::form
RuleExpressionForm::submitForm public function Implements ExpressionFormInterface::submitForm(). Overrides ExpressionFormTrait::submitForm
RuleExpressionForm::__construct public function Creates a new object of this class.