/** * {@inheritdoc} */ public function submitForm(array &$form, FormStateInterface $form_state) { parent::submitForm($form, $form_state); $target_entity = $form_state->getValue('entity'); $target_bundle = $form_state->getValue('bundle', $target_entity); $this->entity->set('target_entity_type', $target_entity); $this->entity->set('target_bundle', $target_bundle); if ($target_entity !== $target_bundle) { drupal_set_message($this->t('A entity layout for the @entity entity and @bundle bundle has been created.', ['@entity' => $this->entityLayoutService->getTargetEntityLabel($this->entity), '@bundle' => $this->entityLayoutService->getTargetBundleLabel($this->entity)])); } else { drupal_set_message($this->t('A entity layout for the @entity entity has been created.', ['@entity' => $this->entityLayoutService->getTargetEntityLabel($this->entity)])); } $form_state->setRedirectUrl($this->entity->toUrl('collection')); }