You are here

function NodeForm::updateStatus in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/node/src/NodeForm.php \Drupal\node\NodeForm::updateStatus()

Entity builder updating the node status with the submitted value.

Parameters

string $entity_type_id: The entity type identifier.

\Drupal\node\NodeInterface $node: The node 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\node\NodeForm::form()

File

core/modules/node/src/NodeForm.php, line 227
Contains \Drupal\node\NodeForm.

Class

NodeForm
Form controller for the node edit forms.

Namespace

Drupal\node

Code

function updateStatus($entity_type_id, NodeInterface $node, array $form, FormStateInterface $form_state) {
  $element = $form_state
    ->getTriggeringElement();
  if (isset($element['#published_status'])) {
    $node
      ->setPublished($element['#published_status']);
  }
}