getMetadata

Learn how to read the metadata of the resolved content.

This method gives you the metadata of the resolved content, such as its version and source.

Signature

This method has the following signature:

public function getMetadata(): ?SlotMetadata

This method returns the metadata of the resolved content, or null when no metadata is available.

Example

Here is a basic example of how to use this method:

<?phpuse Croct\Plug\Croct;use Croct\Plug\FetchOptions;
$croct = Croct::fromDotenv();$options = FetchOptions::defaults()->withSchema();$response = $croct->fetchContent('home-banner', $options);$metadata = $response->getMetadata();