Commit 6a1683c1 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Use existing functions to test for installed plugins



This commit changes a couple of places where it's possible to check
for installed plugins using plugins_installed() instead of a new db
query.

Change-Id: I3e769a0858d8db776bf7d8e14102c49b5b9f7b07
Signed-off-by: default avatarRichard Mansfield <richard.mansfield@catalyst.net.nz>
parent 0016ecdc
......@@ -1614,7 +1614,7 @@ function group_get_menu_tabs() {
if ($role) {
safe_require('grouptype', $group->grouptype);
$artefactplugins = call_static_method('GroupType' . $group->grouptype, 'get_group_artefact_plugins');
if ($plugins = get_records_array('artefact_installed', 'active', 1)) {
if ($plugins = plugins_installed('artefact')) {
foreach ($plugins as &$plugin) {
if (!in_array($plugin->name, $artefactplugins)) {
continue;
......
......@@ -1364,7 +1364,7 @@ function blocktype_name_to_namespaced($blocktype) {
static $resultcache = array();
if (!isset($resultcache[$blocktype])) {
$artefactplugin = get_field('blocktype_installed', 'artefactplugin', 'name', $blocktype);
$artefactplugin = blocktype_artefactplugin($blocktype);
if ($artefactplugin) {
$resultcache[$blocktype] = "$artefactplugin/$blocktype";
}
......
......@@ -1710,7 +1710,7 @@ class View {
foreach($instancejs as &$jsfile) {
$jsfile = (is_array($jsfile) && isset($jsfile['file'])) ? $jsfile['file'] : $jsfile;
if(strpos($jsfile, 'http://') === false) {
if($artefactplugin = get_field('blocktype_installed', 'artefactplugin', 'name', $pluginname)) {
if ($artefactplugin = blocktype_artefactplugin($pluginname)) {
$jsfile = 'artefact/' . $artefactplugin . '/blocktype/' .
$pluginname . '/' . $jsfile;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment