Commit ffc2f728 authored by RoSk0's avatar RoSk0

Added relation form.

parent a3cc89fd
<?php
namespace Drupal\crm_core_user_sync\Form;
use Drupal\Core\Entity\ContentEntityForm;
use Drupal\Core\Form\FormStateInterface;
/**
* Form controller for the relation entity edit forms.
*/
class RelationForm extends ContentEntityForm {
/**
* {@inheritdoc}
*/
public function save(array $form, FormStateInterface $form_state) {
$entity = $this->getEntity();
$result = $entity->save();
$link = $entity->toLink($this->t('View'))->toString();
$logger_arguments = ['link' => $link];
if ($result == SAVED_NEW) {
$this->messenger()->addMessage($this->t('New relation has been created.'));
$this->logger('crm_core_user_sync')->notice('Created new relation', $logger_arguments);
}
else {
$this->messenger()->addMessage($this->t('The relation has been updated.'));
$this->logger('crm_core_user_sync')->notice('Relation updated', $logger_arguments);
}
$form_state->setRedirect('entity.crm_core_user_sync_relation.collection');
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment