Hello everybody !
We've just updated XF from version 1 to version 2.3. In version 1, we had the XFRM add-on (v1.2.4), which we're trying to update to version 2.3.4.
We get the following error (on-click upgrade or manually uploading the add-on)
Do you have any suggestions to help me?
Thank you in advance.
We've just updated XF from version 1 to version 2.3. In version 1, we had the XFRM add-on (v1.2.4), which we're trying to update to version 2.3.4.
We get the following error (on-click upgrade or manually uploading the add-on)
InvalidArgumentException: Unknown widget 'xfrm_forum_overview_new_resources' src/addons/XFRM/Setup.php:1328
Looking at the add-on's code (Setup.php), the problem seems to be linked to the getDefaultWidgetSetup() method, which returns an array without a key named “xfrm_forum_overview_new_resources” (see the code below).
PHP:
protected function getDefaultWidgetSetup()
{
return [
'xfrm_list_featured_resources' => function ($key, array $options = [])
{
$options = array_replace([
'contextual' => true,
'style' => 'carousel',
'content_type' => 'resource',
], $options);
$this->createWidget(
$key,
'featured_content',
[
'positions' => [
'xfrm_overview_above_resources' => 100,
'xfrm_category_above_resources' => 100,
],
'options' => $options,
],
'Featured resources'
);
},
'xfrm_list_top_resources' => function ($key, array $options = [])
{
$options = array_replace([], $options);
$this->createWidget(
$key,
'xfrm_top_resources',
[
'positions' => [
'xfrm_category_sidenav' => 100,
'xfrm_overview_sidenav' => 100,
],
'options' => $options,
]
);
},
'xfrm_list_trending_resources' => function ($key, array $options = [])
{
$options = array_replace([
'contextual' => true,
'style' => 'simple',
'content_type' => 'resource',
], $options);
$this->createWidget(
$key,
'trending_content',
[
'positions' => [
'xfrm_category_sidenav' => 150,
'xfrm_overview_sidenav' => 150,
],
'options' => $options,
],
'Trending resources'
);
},
'xfrm_overview_latest_reviews' => function ($key, array $options = [])
{
$options = array_replace([], $options);
$this->createWidget(
$key,
'xfrm_latest_reviews',
[
'positions' => ['xfrm_overview_sidenav' => 200],
'options' => $options,
]
);
},
'xfrm_overview_top_authors' => function ($key, array $options = [])
{
$options = array_replace([
'member_stat_key' => 'xfrm_most_resources',
], $options);
$this->createWidget(
$key,
'member_stat',
[
'positions' => ['xfrm_overview_sidenav' => 300],
'options' => $options,
]
);
},
'xfrm_overview_statistics' => function ($key, array $options = [])
{
$options = array_replace([], $options);
$this->createWidget(
$key,
'xfrm_resource_statistics',
[
'positions' => ['xfrm_overview_sidenav' => 400],
'options' => $options,
]
);
},
'xfrm_whats_new_overview_new_resources' => function ($key, array $options = [])
{
$options = array_replace([
'limit' => 10,
'style' => 'full',
], $options);
$this->createWidget(
$key,
'xfrm_new_resources',
[
'positions' => ['whats_new_overview' => 200],
'options' => $options,
]
);
},
];
}
protected function insertNamedWidget($key, array $options = [])
{
$widgets = $this->getDefaultWidgetSetup();
if (!isset($widgets[$key]))
{
throw new \InvalidArgumentException("Unknown widget '$key'");
}
$widgetFn = $widgets[$key];
$widgetFn($key, $options);
}
Do you have any suggestions to help me?
Thank you in advance.
Last edited: