You are here

protected static function MatomoAdminSettingsForm::getForbiddenTokens in Matomo 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 MatomoAdminSettingsForm::getForbiddenTokens()
MatomoAdminSettingsForm::tokenElementValidate in src/Form/MatomoAdminSettingsForm.php
Validate a form element that should have tokens in it.

File

src/Form/MatomoAdminSettingsForm.php, line 734

Class

MatomoAdminSettingsForm
Configure Matomo settings for this site.

Namespace

Drupal\matomo\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;
}