You are here

class ActionUploadRemoveFile in N1ED - Visual editor as CKEditor plugin with Bootstrap support 8.2

Action for processing removing file from a upload list.

Hierarchy

Expanded class hierarchy of ActionUploadRemoveFile

1 file declares its use of ActionUploadRemoveFile
Actions.php in src/Flmngr/FileUploaderServer/lib/Actions.php

File

src/Flmngr/FileUploaderServer/lib/action/ActionUploadRemoveFile.php, line 13

Namespace

Drupal\n1ed\Flmngr\FileUploaderServer\lib\action
View source
class ActionUploadRemoveFile extends AActionUploadId {

  /**
   * {@inheritdoc}
   */
  public function getName() {
    return "uploadRemoveFile";
  }

  /**
   * {@inheritdoc}
   */
  public function run($req) {
    $this
      ->validateUploadId($req);
    $file = new FileUploaded($this->config, $req->uploadId, $req->name, $req->name);
    $file
      ->checkForErrors(TRUE);
    if ($file
      ->getErrors()
      ->size() > 0) {
      throw new MessageException(Message::createMessageByFile(Message::UNABLE_TO_DELETE_UPLOAD_DIR, $file
        ->getData()));
    }
    $file
      ->delete();
    return new RespOk();
  }

}

Members

Namesort descending Modifiers Type Description Overrides
AAction::$config protected property
AAction::setConfig public function Sets a config.
AAction::validateBoolean protected function Validates boolean and returns default value if null.
AAction::validateInteger protected function Validates integer and returns default value if null.
AAction::validateString protected function Validates string and returns default value if null.
AActionUploadId::validateUploadId protected function Validates upload ID and throws exception in case of validation error.
ActionUploadRemoveFile::getName public function Returnes name of action. Overrides AAction::getName
ActionUploadRemoveFile::run public function Runs action. Overrides AAction::run