function MockQuickEditEntityFieldAccessCheck::accessEditEntityField
Same name in other branches
- 8.9.x core/modules/quickedit/tests/modules/src/MockQuickEditEntityFieldAccessCheck.php \Drupal\quickedit_test\MockQuickEditEntityFieldAccessCheck::accessEditEntityField()
Overrides QuickEditEntityFieldAccessCheckInterface::accessEditEntityField
File
-
core/
modules/ quickedit/ tests/ modules/ src/ MockQuickEditEntityFieldAccessCheck.php, line 17
Class
- MockQuickEditEntityFieldAccessCheck
- Access check for in-place editing entity fields.
Namespace
Drupal\quickedit_testCode
public function accessEditEntityField(EntityInterface $entity, $field_name) {
switch (\Drupal::state()->get('quickedit_test_field_access')) {
case 'allowed':
return AccessResult::allowed();
case 'neutral':
return AccessResult::neutral();
case 'forbidden':
return AccessResult::forbidden();
default:
throw new \OutOfRangeException("The state for the 'quickedit_test_field_access' key must be either 'allowed', 'neutral' or 'forbidden'.");
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.