function StageBase::setMetadata

Stores arbitrary metadata associated with this stage.

Only the owner of the stage can set metadata, and the stage must either be claimed by its owner, or created during the current request.

Parameters

string $key: The key under which to store the metadata. To prevent conflicts, it is strongly recommended that this be prefixed with the name of the module storing the data.

mixed $data: The metadata to store.

1 call to StageBase::setMetadata()
StageBase::apply in core/modules/package_manager/src/StageBase.php
Applies staged changes to the active directory.

File

core/modules/package_manager/src/StageBase.php, line 254

Class

StageBase
Creates and manages a stage directory in which to install or update code.

Namespace

Drupal\package_manager

Code

public function setMetadata(string $key, $data) : void {
    $this->checkOwnership();
    $metadata = $this->tempStore
        ->get(static::TEMPSTORE_METADATA_KEY);
    $metadata[$key] = $data;
    $this->tempStore
        ->set(static::TEMPSTORE_METADATA_KEY, $metadata);
}

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