intoeetive/protectedlinks

PHP function for protectedLinks

Closed this issue · 1 comments

Hi, we are in the processing of integrating this plugin with Elements API but we are not sure about the PHP function to output protected links

We have tried the following

use Craft;
Craft::$app->protectedLinks->link([ 'assetId' => $entry->file->first()->id ]);

But it doesn't work. Can you help?

Nevermind, just figured it out.

use intoeetive\protectedlinks\variables\ProtectedLinksVariable;
$protectedLinks = new ProtectedLinksVariable();
$link = $protectedLinks->link([ 'assetId' => $entry->file->first()->id ]);

Thanks for this awesome plugin!