-1

I have a tool inside my package (it is a loopback page which will be displayed at the end of an external authentication flow).

The page should display the package icon but because the base is an unusual URL I can't get anything relative to it and I'm not sure how I can get the icon.

URLHelper:getPackageIcon($pkg) no longer exists but if I can get the package object I'm sure I can still get the URL for the icon but I'm not sure how to get the package either.

I already tried the following

$package = Package::getByID($this->getPackageID());
$package_path = BASE_URL . $package->getRelativePath() . '/icon.png';
Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
Nick Cardoso
  • 20,807
  • 14
  • 73
  • 124

1 Answers1

1

the tool is not aware of the package object. $this will be a view object.

$pkg=Package::getByHandle('my_package_handle');
$icon_url = $pkg->getRelativePath(). '/icon.png';

You may also be able to get away without BASE_URL.

JohntheFish
  • 167
  • 1
  • 6