iframe_consent-1.0.x-dev/src/Service/IframeConsentHelperInterface.php

src/Service/IframeConsentHelperInterface.php
<?php

namespace Drupal\iframe_consent\Service;

use Drupal\Core\Template\Attribute;
use Drupal\iframe_consent\IframeConsentDomainInterface;

/**
 * Interface for IframeConsentHelper.
 *
 * @package Drupal\iframe_consent\Service
 */
interface IframeConsentHelperInterface {

  /**
   * Alter iframe attributes for consent handling.
   *
   * @param \Drupal\Core\Template\Attribute|array $iframe_attributes
   *   The iframe attributes to alter.
   *
   * @return \Drupal\Core\Template\Attribute|array
   *   The modified iframe attributes.
   */
  public function alterIframeAttributes(Attribute|array $iframe_attributes): Attribute|array;

  /**
   * Add libraries to the given render array.
   *
   * @param array $build
   *   The render array.
   *
   * @return void
   *   The modified render array.
   */
  public function attachLibraries(array &$build): void;

  /**
   * Clean the URI to extract the domain.
   *
   * @param string $uri
   *   The URI to check.
   *
   * @return string
   *   The sanitized domain if found, empty string otherwise.
   */
  public function cleanUri(string $uri): string;

  /**
   * Clean up the cache tags.
   */
  public function clearCacheTags();

  /**
   * Get the domain from a given URI.
   *
   * @param \Drupal\iframe_consent\IframeConsentDomainInterface $entity
   *   The entity to check.
   *
   * @return array
   *   The domain if found, NULL otherwise.
   */
  public function getDomainConsentGroups(IframeConsentDomainInterface $entity): array;

  /**
   * Get consent groups for a given URI.
   *
   * @param string $uri
   *   The URI to check.
   *
   * @return array
   *   Array of consent groups associated with the URI.
   */
  public function getConsentGroupsByUri(string $uri): array;

  /**
   * Get the template ID by domain.
   *
   * @param string $domain
   *   The domain to check.
   *
   * @return string
   *   The template ID.
   */
  public function getTemplateIdByDomain(string $domain): string;

  /**
   * Check if the given string is in the domains list.
   *
   * @param string $uri
   *   The string to check.
   *
   * @return bool
   *   TRUE if is the $uri contains any of the domains in the list.
   */
  public function isInDomainsList(string $uri): bool;

  /**
   * Set cache tags to the given render array.
   *
   * @param array $build
   *   The render array.
   *
   * @return void
   *   The modified render array.
   */
  public function setCacheTags(array &$build): void;

}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc