You are here

protected static function PiwikAdminSettingsForm::getForbiddenTokens in Piwik Web Analytics 8

Get an array of all forbidden tokens.

Parameters

array $value: An array of token values.

Return value

array A unique array of invalid tokens.

1 call to PiwikAdminSettingsForm::getForbiddenTokens()
PiwikAdminSettingsForm::tokenElementValidate in src/Form/PiwikAdminSettingsForm.php
Validate a form element that should have tokens in it.

File

src/Form/PiwikAdminSettingsForm.php, line 641

Class

PiwikAdminSettingsForm
Configure Piwik settings for this site.

Namespace

Drupal\piwik\Form

Code

protected static function getForbiddenTokens(array $value) {
  $invalid_tokens = [];
  $value_tokens = is_string($value) ? \Drupal::token()
    ->scan($value) : $value;
  foreach ($value_tokens as $tokens) {
    if (array_filter($tokens, 'static::containsForbiddenToken')) {
      $invalid_tokens = array_merge($invalid_tokens, array_values($tokens));
    }
  }
  array_unique($invalid_tokens);
  return $invalid_tokens;
}