View Issue Details

IDProjectCategoryView StatusLast Update
0037146mantisbtplug-inspublic2026-05-21 12:56
Reporterraspopov Assigned Tocommunity  
PrioritynormalSeverityfeatureReproducibilityalways
Status assignedResolutionopen 
Summary0037146: Difficult to use the Mantis Graph plugin from within other plugins
Description

The Mantis Graph plugin offers a variety of useful features for displaying charts in a simple way. This encourages developers of other plugins to take advantage of this free functionality and add Mantis Graph as one of their dependencies.

However, developers have to manually include the MantisGraph.js file in their code because the Mantis Graph plugin does not provide an easy way to load it automatically, despite the file being included in the plugin.

Additional Information

It is proposed that the plugin be updated to utilize the features added in 0036874, and that all necessary downloadable files — including MantisGraph.js — be bundled into the existing include_chartjs() method.

TagsNo tags attached.

Relationships

related to 0036874 resolvedcommunity Support CDN in require_js and require_css functions 

Activities

raspopov

raspopov

2026-05-20 14:07

reporter   ~0071140

Last edited: 2026-05-20 14:11

PR: https://github.com/mantisbt/mantisbt/pull/2226

It is important to note that the call plugin_file( ..., false, $this->basename ) is specified exactly this way, since this function may be called from another plugin; in that case, the current plugin will be the caller, not Mantis Graph.

Example of using Mantis Graph from other plugins:

/**
 * EVENT_CORE_HEADERS hook.
 */
public function core_headers() {
    ...
    if( plugin_is_loaded( 'MantisGraph' ) ) {
        if( gpc_get_string( 'page', '' ) === $this->basename . '/my_page_with_graphs.php' ) {
            $t_mantisgraph = plugin_get( 'MantisGraph' );
            $t_mantisgraph->include_chartjs();
        }
    }
}