protected function SynonymForm::init in Synonyms 8
Same name and namespace in other branches
- 2.0.x src/Form/SynonymForm.php \Drupal\synonyms\Form\SynonymForm::init()
Initialize the form state and the entity before the first form build.
Overrides EntityForm::init
File
- src/
Form/ SynonymForm.php, line 123
Class
- SynonymForm
- Entity form for 'synonym' config entity type.
Namespace
Drupal\synonyms\FormCode
protected function init(FormStateInterface $form_state) {
parent::init($form_state);
if ($this->entity
->isNew()) {
$this->controlledEntityType = $this
->getRequest()
->get('synonyms_entity_type')
->id();
$this->controlledBundle = $this
->getRequest()
->get('bundle');
$this->behaviorServiceId = $this
->getRouteMatch()
->getRawParameter('synonyms_behavior_service');
}
else {
$plugin_definition = $this->entity
->getProviderPluginInstance()
->getPluginDefinition();
$this->controlledEntityType = $plugin_definition['controlled_entity_type'];
$this->controlledBundle = $plugin_definition['controlled_bundle'];
$this->behaviorServiceId = $plugin_definition['synonyms_behavior_service'];
}
}