class EmbeddedComponentForm
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 \Drupal\Core\Form\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
Title Sort descending | Modifiers | Object type | Summary | Overriden Title |
---|---|---|---|---|
EmbeddedComponentForm::$rulesUiHandler | protected | property | The RulesUI handler of the currently active UI. | |
EmbeddedComponentForm::buildForm | public | function | Form constructor. | Overrides FormInterface::buildForm |
EmbeddedComponentForm::getFormHandler | protected | function | Gets the form handler for the component's expression. | |
EmbeddedComponentForm::getFormId | public | function | Returns a unique string identifying the form. | Overrides FormInterface::getFormId |
EmbeddedComponentForm::submitForm | public | function | Form submission handler. | Overrides FormInterface::submitForm |
EmbeddedComponentForm::validateForm | public | function | Form validation handler. | Overrides FormInterface::validateForm |
EmbeddedComponentForm::__construct | public | function | Constructs the object. |