You are here

public function DataPolicyConsentManager::isRequiredEntityInEntities in Data Policy 8

Check if data policy is required.

Parameters

array $data_policy_ids: The list of entity ids.

Return value

bool TRUE if data policy entity is required.

Overrides DataPolicyConsentManagerInterface::isRequiredEntityInEntities

1 call to DataPolicyConsentManager::isRequiredEntityInEntities()
DataPolicyConsentManager::isRequiredEntity in src/DataPolicyConsentManager.php

File

src/DataPolicyConsentManager.php, line 386

Class

DataPolicyConsentManager
Defines the Data Policy Consent Manager service.

Namespace

Drupal\data_policy

Code

public function isRequiredEntityInEntities(array $data_policy_ids) : bool {
  $consent_text = $this
    ->getConfig('consent_text');
  preg_match_all("#\\[id:(.*)\\]#", $consent_text, $matches);
  foreach ($matches[1] as $match) {
    if (strpos($match, '*') !== FALSE && in_array((int) $match, $data_policy_ids)) {
      return TRUE;
    }
  }
  return FALSE;
}