feat(exclusions): Implement component exclusion system (Plan 99.11)
Adds ability to exclude components from specific: - Categories (by slug or term_id) - Post/Page IDs - URL patterns (substring or regex) Architecture: - Domain: Value Objects (CategoryExclusion, PostIdExclusion, UrlPatternExclusion, ExclusionRuleSet) + Contracts - Application: EvaluateExclusionsUseCase + EvaluateComponentVisibilityUseCase (orchestrator) - Infrastructure: WordPressExclusionRepository, WordPressPageContextProvider, WordPressServerRequestProvider - Admin: ExclusionFormPartial (reusable UI), ExclusionFieldProcessor, JS toggle The PageVisibilityHelper now uses the orchestrator UseCase that combines page-type visibility (Plan 99.10) with exclusion rules. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
37
Shared/Domain/ValueObjects/ExclusionRule.php
Normal file
37
Shared/Domain/ValueObjects/ExclusionRule.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace ROITheme\Shared\Domain\ValueObjects;
|
||||
|
||||
/**
|
||||
* Clase base abstracta para reglas de exclusion
|
||||
*
|
||||
* Define el contrato comun para todos los tipos de exclusion.
|
||||
* Cada implementacion concreta define su logica de matching.
|
||||
*
|
||||
* @package ROITheme\Shared\Domain\ValueObjects
|
||||
*/
|
||||
abstract class ExclusionRule
|
||||
{
|
||||
/**
|
||||
* Evalua si el contexto actual coincide con la regla
|
||||
*
|
||||
* @param array<string, mixed> $context Contexto de la pagina actual
|
||||
* @return bool True si el contexto coincide (debe excluirse)
|
||||
*/
|
||||
abstract public function matches(array $context): bool;
|
||||
|
||||
/**
|
||||
* Verifica si la regla tiene valores configurados
|
||||
*
|
||||
* @return bool True si hay valores configurados
|
||||
*/
|
||||
abstract public function hasValues(): bool;
|
||||
|
||||
/**
|
||||
* Serializa los valores para almacenamiento
|
||||
*
|
||||
* @return string JSON string
|
||||
*/
|
||||
abstract public function serialize(): string;
|
||||
}
|
||||
Reference in New Issue
Block a user