J3.x

J3.x:Integrate Extensions with the Privacy Component

From Joomla! Documentation

Revision as of 01:58, 29 August 2018 by Mbabker (talk | contribs) (Created page with "The information below is provided to extension developers to help create integrations with the Privacy Tool Suite. == Privacy Related Extension...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

The information below is provided to extension developers to help create integrations with the Privacy Tool Suite.

Privacy Related Extension Capabilities

The new privacy component has a Capabilities section which allows extensions to report privacy related capabilities. The aim for this section is to help users to understand what an extension may do related to personal data on users and help site owners plan accordingly. For details on this section, including how a plugin should integrate with it, please see the Report Extension Capabilities in Privacy Component page.

Check for a Published Privacy Policy

The privacy component's health check notifies users if there is a privacy policy published on the website. This check is performed by the onPrivacyCheckPrivacyPolicyPublished event which can be subscribed to by plugins in the privacy, system, and user plugin groups. The event receives an associative array by reference with two keys as its argument:

  • "published" - A boolean value indicating that there is a published policy
  • "editLink" - The URL to edit the policy item, this is displayed if there is a privacy policy published

As a best practice, it is suggested that plugins first check if the "published" flag is already set to true and not make further changes to the data array if so. Note that the System - Privacy Consent core plugin will process this event.

public function onPrivacyCheckPrivacyPolicyPublished(&$policy)
{
	// If another plugin has already indicated a policy is published, we won't change anything here
	if ($policy['published'])
	{
		return;
	}

	// Do stuff to find the privacy policy data

	$policy['published'] = true;
	$policy['editLink']  = ''; // The link to the item's edit page, processed through JRoute, i.e. JRoute::_('index.php?option=com_content&task=article.edit&id=1');
}