Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use DrupalnodeEntityNode;
- use DrupalCoreUrl;
- public function submitForm(array &$form, FormStateInterface $form_state) {
- $newCompanyNode = Node::create([
- 'type' => 'company',
- 'title' => $form_state->getValue('company'),
- //'field_name' => $value,
- ]);
- $newCompanyNode->save();
- drupal_set_message('Your company has been registered.', 'status');
- $url = DrupalCoreUrl::fromRoute('entity.node.canonical', ['node' => $newCompanyNode->id()]);
- return $form_state->setRedirectUrl($url);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement