@Findus23 opened this Issue on April 22nd 2020 Member

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.

@tsteur commented on April 22nd 2020 Member

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.

@tassoman commented on April 22nd 2020 Contributor

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.

@tassoman commented on June 8th 2020 Contributor

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

Istantanea_2020-06-08_17-23-43

            <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: {key: 'custom', value: 'Custom period'} in a conditional mode (by user's privileges).

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.
I need to remove the «custom report» from comparison. Angular components aren't reachable by jQuery.

Powered by GitHub Issue Mirror