function CKEditor5ImageController::imageUploadEnabledAccess

Same name in other branches
  1. 9 core/modules/ckeditor5/src/Controller/CKEditor5ImageController.php \Drupal\ckeditor5\Controller\CKEditor5ImageController::imageUploadEnabledAccess()
  2. 10 core/modules/ckeditor5/src/Controller/CKEditor5ImageController.php \Drupal\ckeditor5\Controller\CKEditor5ImageController::imageUploadEnabledAccess()

Access check based on whether image upload is enabled or not.

Parameters

\Drupal\editor\Entity\Editor $editor: The text editor for which an image upload is occurring.

Return value

\Drupal\Core\Access\AccessResultInterface The access result.

1 string reference to 'CKEditor5ImageController::imageUploadEnabledAccess'
ckeditor5.routing.yml in core/modules/ckeditor5/ckeditor5.routing.yml
core/modules/ckeditor5/ckeditor5.routing.yml

File

core/modules/ckeditor5/src/Controller/CKEditor5ImageController.php, line 176

Class

CKEditor5ImageController
Returns response for CKEditor 5 Simple image upload adapter.

Namespace

Drupal\ckeditor5\Controller

Code

public function imageUploadEnabledAccess(Editor $editor) {
    if ($editor->getEditor() !== 'ckeditor5') {
        return AccessResult::forbidden();
    }
    if ($editor->getImageUploadSettings()['status'] !== TRUE) {
        return AccessResult::forbidden();
    }
    return AccessResult::allowed();
}

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