getSlotContent
Learn how to provide the content of a slot.
An implementation must return the content of the given slot for the requested language, or null when no content is available.
Signature
This method has the following signature:
public function getSlotContent(string $id, ?string $language = null): ?arrayThis method returns the slot content as an associative array, or null when no content is available.
Example
This example loads each slot’s content from a CMS:
123456789101112131415161718
<?phpuse Croct\Plug\Content\ContentProvider;
final class CmsContentProvider implements ContentProvider{ private Cms $cms;
public function __construct(Cms $cms) { $this->cms = $cms; }
public function getSlotContent(string $id, ?string $language = null): ?array { // Fetch the slot's content from your CMS or database. return $this->cms->getContent($id, $language); }}Parameters
The following list describes the supported parameters: