public function MediaForm::updateStatus in Media entity 8
Entity builder updating the media status with the submitted value.
Parameters
string $entity_type_id: The entity type identifier.
\Drupal\media_entity\MediaInterface $media: The media 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\media\MediaForm::form()
File
- src/
MediaForm.php, line 147
Class
- MediaForm
- Form controller for the media edit forms.
Namespace
Drupal\media_entityCode
public function updateStatus($entity_type_id, MediaInterface $media, array $form, FormStateInterface $form_state) {
$element = $form_state
->getTriggeringElement();
if (isset($element['#published_status'])) {
$media
->setPublished($element['#published_status']);
}
}