Skaiman
Проверенные
		- Сообщения
- 18,439
- Решения
- 236
- Реакции
- 34,154
- Баллы
- 21,375
Хочу добавить функции в плагин [SVG] Forum Statistics Below Nodes, конкретно, блок статистики всех ресурсов форума, всех медиа галереи и всех статей AMS. Так то вывести, вывел:
	
	
	
		
Но в этом случае, если не установлен какой то из плагинов, Article Management System, XenForo Media Gallery или XenForo Resource Manager, будет ошибка.
Есть настройка включения блоков (svg_fsbn_block_enable), чекбоксы, с помощью шаблона:
	
	
	
		
Прошу помочь привязать настройку к php файлу виджета, что бы если выключен блок, то и обращение из файла не будет.
				
			
		PHP:
	
	<?php
namespace SVG\ForumStatisticsBelowNodes\Widget;
use XF\Widget\AbstractWidget;
class Forumstatistics extends AbstractWidget
{
    public function render()
    {
        $db = \XF::db();
        $resourcesStatistics = $db->fetchOne("
        SELECT COUNT(resource_id)
        FROM xf_rm_resource
        ");       
        $viewParams = [
            'forumStatistics' => $this->app->forumStatistics,
            'articleStatistics' => $this->app->simpleCache()['XenAddons/AMS']['statisticsCache'],
            'resourcesStatistics' => $resourcesStatistics,
            'galleryStatistics' => $this->app->simpleCache()->XFMG->statisticsCache
        ];     
        return $this->renderer('svg_fsbn', $viewParams);
    }
    public function getOptionsTemplate()
    {
        return null;
    }
}Есть настройка включения блоков (svg_fsbn_block_enable), чекбоксы, с помощью шаблона:
		Код:
	
	<xf:checkboxrow rowclass="{$rowClass}"
    label="{$titleHtml}"
    hint="{$hintHtml}"
    explain="{$property.description}">
    <xf:option name="{$formBaseKey}[threads]" selected="{$property.property_value.threads}">
        {{ phrase('threads') }}
    </xf:option>
    <xf:option name="{$formBaseKey}[messages]" selected="{$property.property_value.messages}">
        {{ phrase('messages') }}
    </xf:option>
    <xf:option name="{$formBaseKey}[articles]" selected="{$property.property_value.articles}">
        {{ phrase('xa_ams_articles') }}
    </xf:option>
    <xf:option name="{$formBaseKey}[resources]" selected="{$property.property_value.resources}">
        {{ phrase('xfrm_resources') }}
    </xf:option>
    <xf:option name="{$formBaseKey}[media]" selected="{$property.property_value.media}">
        {{ phrase('xfmg_media') }}
    </xf:option>
    <xf:option name="{$formBaseKey}[members]" selected="{$property.property_value.members}">
        {{ phrase('members') }}
    </xf:option>
    <xf:option name="{$formBaseKey}[latest_member]" selected="{$property.property_value.latest_member}">
        {{ phrase('latest_member') }}
    </xf:option>
</xf:checkboxrow> 
				 
						
 
 
		 
 
		 
 
		 
 
		
 
 
		 
 
		