public function ThunderNodeForm::formAlter in Thunder 8.4
Same name and namespace in other branches
- 8.5 modules/thunder_article/src/Form/ThunderNodeForm.php \Drupal\thunder_article\Form\ThunderNodeForm::formAlter()
- 8.2 modules/thunder_article/src/Form/ThunderNodeForm.php \Drupal\thunder_article\Form\ThunderNodeForm::formAlter()
- 8.3 modules/thunder_article/src/Form/ThunderNodeForm.php \Drupal\thunder_article\Form\ThunderNodeForm::formAlter()
- 6.2.x modules/thunder_article/src/Form/ThunderNodeForm.php \Drupal\thunder_article\Form\ThunderNodeForm::formAlter()
- 6.0.x modules/thunder_article/src/Form/ThunderNodeForm.php \Drupal\thunder_article\Form\ThunderNodeForm::formAlter()
- 6.1.x modules/thunder_article/src/Form/ThunderNodeForm.php \Drupal\thunder_article\Form\ThunderNodeForm::formAlter()
File
- modules/
thunder_article/ src/ Form/ ThunderNodeForm.php, line 109
Class
- ThunderNodeForm
- Base for handler for node add/edit forms.
Namespace
Drupal\thunder_article\FormCode
public function formAlter(array &$form, FormStateInterface $form_state) {
/** @var \Drupal\Core\Entity\ContentEntityFormInterface $form_object */
$form_object = $form_state
->getFormObject();
/** @var \Drupal\node\NodeInterface $entity */
$entity = $form_object
->getEntity();
$storage = $this->entityTypeManager
->getStorage($entity
->getEntityTypeId());
$latest_revision_id = $storage
->getLatestTranslationAffectedRevisionId($entity
->id(), $entity
->language()
->getId());
if ($latest_revision_id !== NULL && $this->moderationInfo && $this->moderationInfo
->hasPendingRevision($entity)) {
$this->messenger
->addWarning($this
->t('This %entity_type has unpublished changes from user %user.', [
'%entity_type' => $entity
->get('type')->entity
->label(),
'%user' => $entity
->getRevisionUser()
->label(),
]));
}
$form['actions'] = array_merge($form['actions'], $this
->actions($entity));
return $form;
}