You are here

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

Entity builder updating the unit type status with the submitted value.

Parameters

string $entity_type_id: The entity type identifier.

\Drupal\bat_unit\UnitTypeInterface $unit_type: The unit type 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/UnitTypeForm.php, line 219
Contains \Drupal\bat_unit\Entity\Form\UnitTypeForm.

Class

UnitTypeForm
Form controller for Unit type edit forms.

Namespace

Drupal\bat_unit\Entity\Form

Code

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