You are here

public function UnitForm::updateStatus in Booking and Availability Management Tools for Drupal 8

Entity builder updating the unit status with the submitted value.

Parameters

string $entity_type_id: The entity type identifier.

\Drupal\bat_unit\UnitInterface $unit: The unit updated with the submitted values.

array $form: The complete form array.

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

File

modules/bat_unit/src/Entity/Form/UnitForm.php, line 219
Contains \Drupal\bat_unit\Entity\Form\UnitForm.

Class

UnitForm
Form controller for Unit edit forms.

Namespace

Drupal\bat_unit\Entity\Form

Code

public function updateStatus($entity_type_id, UnitInterface $unit, array $form, FormStateInterface $form_state) {
  $element = $form_state
    ->getTriggeringElement();
  if (isset($element['#published_status'])) {
    $unit
      ->setStatus($element['#published_status']);
  }
}