Contracts

AdminTakeoverInterface

v1.0.0

Implemented by the single module allowed to replace the native wp-admin shell with a Meteorack shell.

Namespace

use Meteorack\Sdk\Core\Contracts\AdminTakeoverInterface;

How To Use It

  • Implement this only on the one module that owns the replacement admin chrome for the site.
  • Gate takeover carefully and use canInstallPlugin() to block installs or activations that would conflict with the managed shell experience.

Works Well With

Methods

public function isTakeoverActive(): bool

Reports whether takeover mode is currently enabled.

public function getDequeueHandles(): array

Returns WordPress CSS and JS handles to remove while takeover is active.

public function renderShell(): void

Outputs the replacement admin shell markup.

public function canInstallPlugin(string $pluginSlug): bool

Decides whether a given plugin slug may be installed or activated while takeover mode is active.

Example

bootstrap.php
<?php

declare(strict_types=1);

use Meteorack\Sdk\Core\Contracts\AdminTakeoverInterface;
use Meteorack\Sdk\RuntimeWp\AbstractModule;

class HubModule extends AbstractModule implements AdminTakeoverInterface
{
    public function getSlug(): string { return 'hub'; }
    public function getName(): string { return 'Hub'; }
    public function getVersion(): string { return '1.0.0'; }

    public function isTakeoverActive(): bool
    {
        return (bool) $this->getSetting('takeover_enabled', false);
    }

    public function getDequeueHandles(): array
    {
        return ['common', 'admin-bar'];
    }

    public function renderShell(): void
    {
        echo '<div id="meteorack-admin-root"></div>';
    }

    public function canInstallPlugin(string $pluginSlug): bool
    {
        return $pluginSlug !== 'classic-editor';
    }
}

return new HubModule();