Пример #1
0
 /**
  * Entity builder: updates the product status with the submitted value.
  *
  * @param string $entity_type
  *   The entity type.
  * @param \Drupal\commerce_product\Entity\ProductInterface $product
  *   The product updated with the submitted values.
  * @param array $form
  *   The complete form array.
  * @param \Drupal\Core\Form\FormStateInterface $form_state
  *   The current state of the form.
  *
  * @see \Drupal\node\NodeForm::form()
  */
 function updateStatus($entity_type, ProductInterface $product, array $form, FormStateInterface $form_state) {
   $element = $form_state->getTriggeringElement();
   if (isset($element['#published_status'])) {
     $product->setPublished($element['#published_status']);
   }
 }