Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Author.Plugin instead of hardcoded plugin version #2

Open
LukeTowers opened this issue Jun 23, 2020 · 3 comments
Open

Use Author.Plugin instead of hardcoded plugin version #2

LukeTowers opened this issue Jun 23, 2020 · 3 comments

Comments

@LukeTowers
Copy link

$controller->addCss($this->settings->getPublicCssPath(), '1.0.2');

You can use Author.Plugin as the second argument to addAsset() which will automatically use the latest version number of the provided plugin. (@bennothommo could you add that to the docs? I don't think we have that behavior documented anywhere that references the System\Traits\AssetMaker)

@magenizr
Copy link
Owner

magenizr commented Jul 8, 2020

Hi @LukeTowers

Thank you for your input! Removing the version number, unfortunately, doesn't automatically add the latest version number because PluginVersion::getVersion($build) in getAssetEntryBuildPath always returns null.

We will provide an update as soon as we know why it returns null.

@LukeTowers
Copy link
Author

@magenizr check your system_plugin_versions table, if your plugin changed the case or exact contents of its identifier then that would be why, since it uses the records in PluginVersion model to get the latest version, not the PluginManager which normalizes the input into a standard ID first

@magenizr
Copy link
Owner

magenizr commented Jul 9, 2020

@LukeTowers

Sorry, I believe the morning coffee didn't kick in when I read your comment. You're absolutely right, one of the following arguments automatically returns the plugin version.

$controller->addCss($this->settings->getPublicCssPath(), ['build' => 'Magenizr.Envbar']);
$controller->addCss($this->settings->getPublicCssPath(), 'Magenizr.Envbar');

https://github.com/octobercms/october/blob/9082a231a6030dc3191ff86088cd624922a3e345/modules/system/traits/AssetMaker.php#L315

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants