class MockQuickEditEntityFieldAccessCheck

Same name in other branches
  1. 8.9.x core/modules/quickedit/tests/modules/src/MockQuickEditEntityFieldAccessCheck.php \Drupal\quickedit_test\MockQuickEditEntityFieldAccessCheck

Access check for in-place editing entity fields.

Hierarchy

Expanded class hierarchy of MockQuickEditEntityFieldAccessCheck

2 files declare their use of MockQuickEditEntityFieldAccessCheck
EditorIntegrationTest.php in core/modules/quickedit/tests/src/Kernel/EditorIntegrationTest.php
MetadataGeneratorTest.php in core/modules/quickedit/tests/src/Kernel/MetadataGeneratorTest.php

File

core/modules/quickedit/tests/modules/src/MockQuickEditEntityFieldAccessCheck.php, line 12

Namespace

Drupal\quickedit_test
View source
class MockQuickEditEntityFieldAccessCheck implements QuickEditEntityFieldAccessCheckInterface {
    
    /**
     * {@inheritdoc}
     */
    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'.");
        }
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title
MockQuickEditEntityFieldAccessCheck::accessEditEntityField public function Checks access to edit the requested field of the requested entity. Overrides QuickEditEntityFieldAccessCheckInterface::accessEditEntityField

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.