function lightning_core_form_alter in Lightning Core 8.4
Same name and namespace in other branches
- 8.5 lightning_core.module \lightning_core_form_alter()
- 8.3 lightning_core.module \lightning_core_form_alter()
Implements hook_form_alter().
File
- ./
lightning_core.module, line 215 - Contains core functionality for the Lightning distribution.
Code
function lightning_core_form_alter(array &$form, FormStateInterface $form_state) {
$form_object = $form_state
->getFormObject();
if ($form_object instanceof ContentEntityFormInterface && isset($form['revision_information']) && $form['revision_information']['#access']) {
// Load the form mode and show the revision information if the form mode
// allows the revision UI to be shown.
$form_display = $form_object
->getFormDisplay($form_state);
$form_mode = $form_display
->getTargetEntityTypeId() . '.' . $form_display
->getMode();
$form_mode = EntityFormMode::load($form_mode);
if ($form_mode) {
$form['revision_information']['#access'] = $form_mode
->getThirdPartySetting('lightning_core', 'revision_ui', TRUE);
}
}
}