On box type edit page, there should be a publishing option "Create a new revision", which will enforce revisions for the given box type. Same functionality as for content types.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

peter.keppert created an issue. See original summary.

Pasqualle’s picture

Title: Box type improvements and default behaviour » Create new revision by default
Issue summary: View changes

The box description request moved under #2900886: Title field label and box type description
The "field_body to new box types automatically" is a too specific request, which does not seems useful any more.

Pasqualle’s picture

Assigned: peter.keppert » Unassigned
Status: Active » Needs review
FileSize
14.65 KB

To fully enforce box revisions (hiding the "Create new revision" checkbox) the following hook needs to be implemented. Similarly as for node revisions.

/**
 * Implements hook_entity_field_access()
 */
function MYMODULE_entity_field_access($operation, FieldDefinitionInterface $field_definition, AccountInterface $account, FieldItemListInterface $items = NULL) {
  if ($account->hasPermission('administer box entities') || $account->hasPermission('delete all box revisions')) {
    return AccessResult::neutral();
  }

  if ($operation == 'update' && $items->getName() === 'vid' && $items->getEntity()->getEntityTypeId() === 'box') {
    return AccessResult::forbidden();
  }
  return AccessResult::neutral();
}

Status: Needs review » Needs work

The last submitted patch, 3: 2895889-3-new_revision.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

Pasqualle’s picture

Status: Needs work » Needs review
FileSize
15.09 KB

  • Pasqualle committed e1166e4 on 8.x-1.x
    Issue #2895889 by Pasqualle: Create new revision by default
    
Pasqualle’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.