Class to create Assets in PHP.
### Examples:
$asset = $this->objectManager->get('FluidTYPO3\\Vhs\\Asset');
OR you can use the static factory method which works anywhere
including outside of Extbase.
$asset = \FluidTYPO3\Vhs\Asset::getInstance();
$asset->setPath('fileadmin/test.js')->setStandalone(TRUE)->finalize();
Or simply:
$this->objectManager->get('FluidTYPO3\\Vhs\\Asset')->setPath('...')->finalize();
And you can create clean instances:
Depending on how you need to access the Asset afterwards, you will
want wo switch between these methods.
Or if you have all settings in an array (with members named according to
the properties on this class:
\FluidTYPO3\Vhs\Asset::createFromSettings($settings)->finalize();
Finally, if your Asset is file based, VHS can perform a few detections to
set initial attributes like standalone, external (if file contains protocol),
type (based on extension) and name (base name of file).
\FluidTYPO3\Vhs\Asset::createFromFile($filePathAndFilename);
\FluidTYPO3\Vhs\Asset::createFromUrl($urlToExternalFile);
You can chain all setters on the class before finally calling finalize() to
register the Asset (you can still modify the Asset afterwards, but an Asset
that has not been finalize()'ed will never show up or be processed - which
is a lot friendlier than requiring you to use remove() on unwanted Assets).
> Note: the "createFrom..." suite of methods automatically calls finalize()
> on your Asset just before returning it. You can of course keep modifying
> the instance after it is returned - but when using a "createFrom"... method
> VHS assumes you always want your Asset included in the output.