$this->getName(), 'id' => Settings::SETTINGS_PREFIX . '_addon_' . $this->getSlug(), 'default' => $this->isActiveByDefault() ? 'yes' : 'no', 'desc' => $this->getDescription(), 'icon' => $this->getIcon(), 'type' => TPTFeatureFlagOption::FIELD_TYPE, ); return $addons; } public function isEnabled(): bool { $settings = $this->getContainer()->getSettings(); $addonKey = '_addon_' . $this->getSlug(); return $settings->get( $addonKey, $this->isActiveByDefault() ? 'yes' : 'no' ) === 'yes'; } protected function isActiveByDefault(): bool { return true; } /** * Whether the add-on with this slug is switched on, without needing its instance. */ public static function isAddonEnabled( string $slug, bool $activeByDefault = true ): bool { $settings = \TierPricingTable\Core\ServiceContainer::getInstance()->getSettings(); return 'yes' === $settings->get( '_addon_' . $slug, $activeByDefault ? 'yes' : 'no' ); } abstract public function getName(); abstract public function getDescription(); abstract public function getIcon(): string; abstract public function getSlug(); abstract public function run(); }