function lightning_workflow_entity_field_access in Lightning Workflow 8.2
Implements hook_entity_field_access().
Tests that rely on promoting a node to the front page cannot access the "Promote to front page" checkbox without the "administer nodes" permission. That totally sucks, so this hook will allow access to the field if lightning_dev is enabled.
File
- ./
lightning_workflow.module, line 243 - Provides workflow enhancements for Drupal.
Code
function lightning_workflow_entity_field_access($operation, FieldDefinitionInterface $field_definition, AccountInterface $account, FieldItemListInterface $items = NULL) {
return Drupal::moduleHandler()
->moduleExists('lightning_dev') && $field_definition
->getTargetEntityTypeId() === 'node' && $field_definition
->getName() === 'promote' && $items ? $items
->getEntity()
->access($operation === 'edit' ? 'update' : $operation, $account, TRUE) : AccessResult::neutral();
}