WildcardUrlInvalidation.php in Purge 8.3
Namespace
Drupal\purge\Plugin\Purge\InvalidationFile
src/Plugin/Purge/Invalidation/WildcardUrlInvalidation.phpView source
<?php
namespace Drupal\purge\Plugin\Purge\Invalidation;
use Drupal\purge\Plugin\Purge\Invalidation\Exception\InvalidExpressionException;
/**
* Describes wildcard URL based invalidation, e.g. "http://site.com/node/*".
*
* @PurgeInvalidation(
* id = "wildcardurl",
* label = @Translation("Url wildcard"),
* description = @Translation("Invalidates by URL."),
* examples = {"http://site.com/node/*"},
* expression_required = TRUE,
* expression_can_be_empty = FALSE
* )
*/
class WildcardUrlInvalidation extends UrlInvalidation implements InvalidationInterface {
/**
* {@inheritdoc}
*/
public function validateExpression($wildcard_check = TRUE) {
$url = parent::validateExpression(FALSE);
if (strpos($url, '*') === FALSE) {
throw new InvalidExpressionException('Wildcard invalidations should contain an asterisk.');
}
}
}
Classes
Name![]() |
Description |
---|---|
WildcardUrlInvalidation | Describes wildcard URL based invalidation, e.g. "http://site.com/node/*". |