/**
  * Entity builder: populates the line item title from the purchased entity.
  *
  * @param string $entity_type
  *   The entity type identifier.
  * @param \Drupal\commerce_order\Entity\LineItemInterface $line_item
  *   The line item.
  * @param array $form
  *   The complete form array.
  * @param \Drupal\Core\Form\FormStateInterface $form_state
  *   The current state of the form.
  */
 public static function populateTitle($entity_type, LineItemInterface $line_item, array $form, FormStateInterface $form_state)
 {
     $purchased_entity = $line_item->getPurchasedEntity();
     if ($line_item->isNew() && $purchased_entity) {
         $line_item->setTitle($purchased_entity->getLineItemTitle());
     }
 }