class EmbeddedComponentForm in Rules 8.3
Components form, ready to be embedded in some other form.
Note, that there is no SubformInterface or such in core (yet), thus we implement FormInterface instead.
Hierarchy
- class \Drupal\rules\Form\EmbeddedComponentForm implements FormInterface
Expanded class hierarchy of EmbeddedComponentForm
1 file declares its use of EmbeddedComponentForm
File
- src/
Form/ EmbeddedComponentForm.php, line 15
Namespace
Drupal\rules\FormView source
class EmbeddedComponentForm implements FormInterface {
/**
* The RulesUI handler of the currently active UI.
*
* @var \Drupal\rules\Ui\RulesUiHandlerInterface
*/
protected $rulesUiHandler;
/**
* Constructs the object.
*
* @param \Drupal\rules\Ui\RulesUiHandlerInterface $rules_ui_handler
* The UI handler of the edited component.
*/
public function __construct(RulesUiHandlerInterface $rules_ui_handler) {
$this->rulesUiHandler = $rules_ui_handler;
}
/**
* Gets the form handler for the component's expression.
*
* @return \Drupal\rules\Form\Expression\ExpressionFormInterface|null
* The form handling object if there is one, NULL otherwise.
*/
protected function getFormHandler() {
return $this->rulesUiHandler
->getComponent()
->getExpression()
->getFormHandler();
}
/**
* {@inheritdoc}
*/
public function getFormId() {
return 'rules_embedded_component_' . $this->rulesUiHandler
->getPluginId();
}
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state) {
$form['locked'] = $this->rulesUiHandler
->addLockInformation();
return $this
->getFormHandler()
->form($form, $form_state);
}
/**
* {@inheritdoc}
*/
public function validateForm(array &$form, FormStateInterface $form_state) {
$this->rulesUiHandler
->validateLock($form, $form_state);
$this
->getFormHandler()
->validateForm($form, $form_state);
}
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
$this
->getFormHandler()
->submitForm($form, $form_state);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
EmbeddedComponentForm:: |
protected | property | The RulesUI handler of the currently active UI. | |
EmbeddedComponentForm:: |
public | function |
Form constructor. Overrides FormInterface:: |
|
EmbeddedComponentForm:: |
protected | function | Gets the form handler for the component's expression. | |
EmbeddedComponentForm:: |
public | function |
Returns a unique string identifying the form. Overrides FormInterface:: |
|
EmbeddedComponentForm:: |
public | function |
Form submission handler. Overrides FormInterface:: |
|
EmbeddedComponentForm:: |
public | function |
Form validation handler. Overrides FormInterface:: |
|
EmbeddedComponentForm:: |
public | function | Constructs the object. |