Commit ddff1b3c authored by catch's avatar catch

Issue #2218691 by dawehner: Move the current user out of the node API chain in book.

parent 0cb6fc70
......@@ -224,8 +224,13 @@ function book_form_node_form_alter(&$form, &$form_state, $form_id) {
*
* @todo: Remove this in favor of an entity field.
*/
function book_node_builder($entity_type, $entity, &$form, &$form_state) {
function book_node_builder($entity_type, NodeInterface $entity, &$form, &$form_state) {
$entity->book = $form_state['values']['book'];
// Always save a revision for non-administrators.
if (!empty($entity->book['bid']) && !\Drupal::currentUser()->hasPermission('administer nodes')) {
$entity->setNewRevision();
}
}
/**
......@@ -447,10 +452,6 @@ function book_node_view(EntityInterface $node, EntityViewDisplayInterface $displ
* Implements hook_node_presave().
*/
function book_node_presave(EntityInterface $node) {
// Always save a revision for non-administrators.
if (!empty($node->book['bid']) && !\Drupal::currentUser()->hasPermission('administer nodes')) {
$node->setNewRevision();
}
// Make sure a new node gets a new menu link.
if ($node->isNew()) {
$node->book['nid'] = NULL;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment