Contracts
SlotProviderInterface
v1.0.0Allows modules to render content into named Meteorack UI slots such as dashboard cards or sidebar regions.
Namespace
use Meteorack\Sdk\Core\Contracts\SlotProviderInterface;How To Use It
- Implement this when your module contributes HTML into named Meteorack shell slots rather than owning the whole page.
- Keep the supported slot list explicit so host shells can discover what your module can render before calling renderSlot().
Works Well With
Methods
public function renderSlot(string $slotName): ?stringReturns rendered HTML for a supported slot or null when the slot is unsupported.
public function getSupportedSlots(): arrayLists the slot names the module can fill.
Example
bootstrap.php
<?php
declare(strict_types=1);
use Meteorack\Sdk\Core\Contracts\SlotProviderInterface;
use Meteorack\Sdk\RuntimeWp\AbstractModule;
class ReportsModule extends AbstractModule implements SlotProviderInterface
{
public function getSlug(): string { return 'reports'; }
public function getName(): string { return 'Reports'; }
public function getVersion(): string { return '1.0.0'; }
public function getSupportedSlots(): array
{
return ['dashboard.cards'];
}
public function renderSlot(string $slotName): ?string
{
if ($slotName !== 'dashboard.cards') {
return null;
}
return '<section class="meteorack-card">Latest reports ready.</section>';
}
}
return new ReportsModule();