-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Allow Plugins to override .directive.html similar to twig templates #15843
Comments
Just FYI: As with the templates, the same would apply to these HTML files that the structure could change at any time and we can't consider any of the variables we assign to the template part of API and keep BC. |
When a template gets overwritten, I think keeping BC or staying update with changes should be a duty of the plugin author, the templates overwriter. |
Let's do a practical example: as plugin developer I would like to remove «custom» ranges from regular users selection, in order to avoid custom report calculations <div
id="comparePeriodToDropdown"
piwik-field
name="comparePeriodToDropdown"
uicontrol="select"
options="[{key: 'previousPeriod', value: 'Previous period'}, {key: 'previousYear', value: 'Previous year'}]"
ng-model="periodSelector.comparePeriodType"
full-width="true"
disabled="!periodSelector.isComparing"
></div> I need to edit the array of options, removing the first item: Doing this goes deeper in the Matomo's UI, but, you know, you can already go deep using jQuery inside a plugin's javascript asset. As you can see, the last «custom» choice from the range list is already gone. |
Hello there, I want to inform you that my plugin upgrade path to 4.x-dev is blocked by this still opened issue. |
@tassoman While I agree that solving this issue would be the right thing to do, I am not sure why your solution wouldn't work any more with Matomo 4. Nothing changed (Matomo used Angular and jQuery before) apart from updating the versions of a few of them. If you want to, I can take a look at how |
The «compare to» select field is populated on rendering, by an array of values can't be overridden anyway (I'm aware of) |
BTW probably it won't help but maybe it's possible to hide certain options through CSS? |
fyi @Findus23 with Angular being removed in 5.x-dev we can maybe close this one? |
With vue it won't be easily possible to overwrite the templates for certain components as they are included in the vue files. |
Plugins/Themes can change how content is rendered either by listening to events in the template or by completely replacing the file in the plugin:
https://developer.matomo.org/guides/theming#twig-the-template-engine
Now that more parts are written in angular, this possibility dissapears, and we should document another way plugins can easily customize pages.
The text was updated successfully, but these errors were encountered: