EmbeddedComponentForm.php in Rules 8.3
File
src/Form/EmbeddedComponentForm.php
View source
<?php
namespace Drupal\rules\Form;
use Drupal\Core\Form\FormInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\rules\Ui\RulesUiHandlerInterface;
class EmbeddedComponentForm implements FormInterface {
protected $rulesUiHandler;
public function __construct(RulesUiHandlerInterface $rules_ui_handler) {
$this->rulesUiHandler = $rules_ui_handler;
}
protected function getFormHandler() {
return $this->rulesUiHandler
->getComponent()
->getExpression()
->getFormHandler();
}
public function getFormId() {
return 'rules_embedded_component_' . $this->rulesUiHandler
->getPluginId();
}
public function buildForm(array $form, FormStateInterface $form_state) {
$form['locked'] = $this->rulesUiHandler
->addLockInformation();
return $this
->getFormHandler()
->form($form, $form_state);
}
public function validateForm(array &$form, FormStateInterface $form_state) {
$this->rulesUiHandler
->validateLock($form, $form_state);
$this
->getFormHandler()
->validateForm($form, $form_state);
}
public function submitForm(array &$form, FormStateInterface $form_state) {
$this
->getFormHandler()
->submitForm($form, $form_state);
}
}