You are here

interface DataPolicyConsentManagerInterface in Data Policy 8

Defines the Data Policy Consent Manager service interface.

Hierarchy

Expanded class hierarchy of DataPolicyConsentManagerInterface

All classes that implement DataPolicyConsentManagerInterface

2 files declare their use of DataPolicyConsentManagerInterface
DataPolicy.php in src/Controller/DataPolicy.php
DataPolicyAgreement.php in src/Form/DataPolicyAgreement.php

File

src/DataPolicyConsentManagerInterface.php, line 10

Namespace

Drupal\data_policy
View source
interface DataPolicyConsentManagerInterface {

  /**
   * Check if user gave consent on a current version of data policy.
   *
   * @return bool
   *   TRUE if consent is needed.
   */
  public function needConsent();

  /**
   * Add checkbox to form which allow user give consent on data policy.
   *
   * @param array $form
   *   An associative array containing the structure of the form.
   */
  public function addCheckbox(array &$form);

  /**
   * Save user consent.
   *
   * @param int $user_id
   *   The user ID.
   * @param string $action
   *   The action (submit and etc.)
   * @param array $values
   *   Array of user consent values to process saveConsent:
   *   - state - required option,
   *   - entity_id - required option,
   *   The one of three allowed states:
   *   - undecided,
   *   - not agree,
   *   - agree.
   */
  public function saveConsent($user_id, $action = NULL, $values = [
    'state' => UserConsentInterface::STATE_UNDECIDED,
  ]);

  /**
   * Get existing user consents.
   *
   * @param int $user_id
   *   The user ID.
   *
   * @return array
   *   The array of existing consents.
   */
  public function getExistingUserConsents($user_id);

  /**
   * Check if data policy is created.
   *
   * @return bool
   *   TRUE if data policy entity is created.
   */
  public function isDataPolicy();

  /**
   * Return value from the configuration.
   *
   * @param string $name
   *   The key in config.
   *
   * @return mixed
   *   The value related with key.
   */
  public function getConfig($name);

  /**
   * Get the entity ids from consent text in settings form.
   *
   * @return array
   *   Entity ids.
   */
  public function getEntityIdsFromConsentText();

  /**
   * Get the list of revisions for specific entities.
   *
   * @param array $entity_ids
   *   The list of entity ids.
   *
   * @return array
   *   The list of revisions.
   */
  public function getRevisionsByEntityIds(array $entity_ids);

  /**
   * Check if data policy is required.
   *
   * @param array $data_policy_ids
   *   The list of entity ids.
   *
   * @return bool
   *   TRUE if data policy entity is required.
   */
  public function isRequiredEntityInEntities(array $data_policy_ids) : bool;

}

Members

Namesort descending Modifiers Type Description Overrides
DataPolicyConsentManagerInterface::addCheckbox public function Add checkbox to form which allow user give consent on data policy. 1
DataPolicyConsentManagerInterface::getConfig public function Return value from the configuration. 1
DataPolicyConsentManagerInterface::getEntityIdsFromConsentText public function Get the entity ids from consent text in settings form. 1
DataPolicyConsentManagerInterface::getExistingUserConsents public function Get existing user consents. 1
DataPolicyConsentManagerInterface::getRevisionsByEntityIds public function Get the list of revisions for specific entities. 1
DataPolicyConsentManagerInterface::isDataPolicy public function Check if data policy is created. 1
DataPolicyConsentManagerInterface::isRequiredEntityInEntities public function Check if data policy is required. 1
DataPolicyConsentManagerInterface::needConsent public function Check if user gave consent on a current version of data policy. 1
DataPolicyConsentManagerInterface::saveConsent public function Save user consent. 1