Open cgrisar opened 6 years ago
Great to see the plugin used like this!
If you hook into gdpr/frontend/privacy-tools-page/content the $dataSubject object is injected into the hooked function automatically. It's always the data subject who is currently viewing the page. So in your case, you could simply do
function lvpConsentForm($dataSubject) {
// do your thing here
}
To get access to the ConsentManager class instance, you can simply do
$consentManager = gdpr('consent');
// and for example, to get all consent types to do your own thing with them:
$consentTypes = $consentManager->getConsentTypes();
The "framework" part might be a bit confusing right now, as not many people have used it like this yet - at least to my knowledge. So any feedback anyone can give me is very much appreciated! I want the plugin to be flexible enough that it's possible to adapt it to any kind of different business logic in a comfortable way.
So, I created some code to add the Privacy Tools Page to the My Account, for which I created a new menu item and endpoint.
In my case, it looks like this (everything into functions.php)
Works like a charm!
Then I needed to change somethings to the way the privacy Tools Page is displayed (make it prettier), as per your documentations. I use lvpConsentForm to create a new form for consents.
But, since I'm working from functions.php to create lvpConsentForm, this is where everything becomes awkward.
How do I create a new ConsentForm out of functions.php? For instance, how do I have access to $dataSubject? What do the urls look like when I want give consent to a consent-type that has been whitdrawn?
The purpose of it is to create a consent form that shows all consents (given or not) and that enables the dataSubject to adapt it freely (for instance, the consents that are not given or have been whitdrawn do not show up with your renderCustomForm)
Thanks for clarifying
Charles