- Issue created by @Pawelgorski87
User can't see published at field event if have access to add/edit this date.
Problem is in $form['published_at']['#group'] = 'revision_information';
function publication_date_form_node_form_alter(&$form, FormStateInterface $form_state, $form_id) {
$account = \Drupal::currentUser();
$node = $form_state->getFormObject()->getEntity();
if (isset($form['published_at'])) {
// Check if the user has permission to edit the publication date.
$form['published_at']['#access'] = $account->hasPermission('set any published on date') || $account->hasPermission('set ' . $node->bundle() . ' published on date');
$form['published_at']['#group'] = 'revision_information';
}
}
There are cases when user doesn't have access to revision_information group, and if we try add published at date that that group, user can't see that.
Create user with minimal permission to edit node + permission at field, without any revision permission.
Try to change publish date.
Move field to other group? Maybe Authoring information?
Or check if access is false and change on true?
Active
Code