You are here

public function DataPolicyConsentManager::getEntityIdsFromConsentText in Data Policy 8

Get the entity ids from consent text in settings form.

Return value

array Entity ids.

Overrides DataPolicyConsentManagerInterface::getEntityIdsFromConsentText

3 calls to DataPolicyConsentManager::getEntityIdsFromConsentText()
DataPolicyConsentManager::addCheckbox in src/DataPolicyConsentManager.php
Add checkbox to form which allow user give consent on data policy.
DataPolicyConsentManager::isDataPolicy in src/DataPolicyConsentManager.php
Check if data policy is created.
DataPolicyConsentManager::saveConsent in src/DataPolicyConsentManager.php
Save user consent.

File

src/DataPolicyConsentManager.php, line 372

Class

DataPolicyConsentManager
Defines the Data Policy Consent Manager service.

Namespace

Drupal\data_policy

Code

public function getEntityIdsFromConsentText() : array {
  $consent_text = $this
    ->getConfig('consent_text');
  preg_match_all("#\\[id:(.*)\\]#", $consent_text, $matches);
  foreach ($matches[1] as $match) {
    $ids[] = (int) $match;
  }
  return $ids ?? [];
}