You are here

public static function WebformRevisionsController::entity_builder in Config Entity Revisions 8

Same name and namespace in other branches
  1. 1.x modules/webform_revisions/src/Controller/WebformRevisionsController.php \Drupal\webform_revisions\Controller\WebformRevisionsController::entity_builder()

Updates the form language to reflect any change to the entity language.

There are use cases for modules to act both before and after form language being updated, thus the update is performed through an entity builder callback, which allows to support both cases.

Parameters

string $entity_type_id: The entity type identifier.

\Drupal\webform\Entity\WebformSubmission $entity: The entity updated with the submitted values.

array $form: The complete form array.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

See also

\Drupal\Core\Entity\ContentEntityForm::form()

File

modules/webform_revisions/src/Controller/WebformRevisionsController.php, line 89

Class

WebformRevisionsController
Controller to make library functions available to various consumers.

Namespace

Drupal\webform_revisions\Controller

Code

public static function entity_builder($entity_type_id, WebformSubmission $entity, array $form, FormStateInterface $form_state) {

  /* @var $webform \Drupal\webform_revisions\Entity\WebformRevisions */
  $webform = $entity
    ->getWebform();
  $entity
    ->set('webform_revision', $webform
    ->getRevisionID());
}