mirror of
https://github.com/humhub/humhub.git
synced 2025-01-17 14:18:27 +01:00
This commit is contained in:
parent
ec5aac5b76
commit
1fae0b8ca8
@ -10,3 +10,4 @@ HumHub Changelog
|
||||
- Enh #5872: Invalidate active sessions after password changing
|
||||
- Enh #5820: Selftest for base URL
|
||||
- Enh #5891: Improve select2 width on people filters
|
||||
- Fix #5903: ContentContainerModule::getEnabledContentContainers() returns an empty array
|
||||
|
@ -9,6 +9,7 @@
|
||||
namespace humhub\modules\content\components;
|
||||
|
||||
use humhub\components\Module;
|
||||
use humhub\modules\content\models\ContentContainer;
|
||||
use humhub\modules\content\models\ContentContainerModuleState;
|
||||
use humhub\modules\content\models\ContentContainerPermission;
|
||||
|
||||
@ -158,11 +159,22 @@ class ContentContainerModule extends Module
|
||||
* Returns an array of all content containers where this module is enabled.
|
||||
*
|
||||
* @param string $containerClass optional filter to specific container class
|
||||
* @return array of content container instances
|
||||
* @return ContentContainer[]
|
||||
*/
|
||||
public function getEnabledContentContainers($containerClass = "")
|
||||
public function getEnabledContentContainers($containerClass = null)
|
||||
{
|
||||
return [];
|
||||
$enabledContentContainers = [];
|
||||
$contentContainerModuleStates = ContentContainerModuleState::findAll(['module_id' => $this->id, 'module_state' => [ContentContainerModuleState::STATE_ENABLED, ContentContainerModuleState::STATE_FORCE_ENABLED]]);
|
||||
foreach ($contentContainerModuleStates as $contentContainerModuleState) {
|
||||
$contentContainer = $contentContainerModuleState->contentContainer;
|
||||
if (
|
||||
$contentContainer !== null
|
||||
&& (!$containerClass || $contentContainer->class === $containerClass)
|
||||
) {
|
||||
$enabledContentContainers[] = $contentContainer;
|
||||
}
|
||||
}
|
||||
return $enabledContentContainers;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -10,6 +10,7 @@ namespace humhub\modules\content\models;
|
||||
|
||||
use Yii;
|
||||
use yii\db\ActiveRecord;
|
||||
use yii\db\ActiveQuery;
|
||||
|
||||
/**
|
||||
* This is the model class for table "contentcontainer_module".
|
||||
@ -17,6 +18,8 @@ use yii\db\ActiveRecord;
|
||||
* @property integer $contentcontainer_id
|
||||
* @property string $module_id
|
||||
* @property integer $module_state
|
||||
*
|
||||
* @property ContentContainer $contentContainer
|
||||
*/
|
||||
class ContentContainerModuleState extends ActiveRecord
|
||||
{
|
||||
@ -51,4 +54,13 @@ class ContentContainerModuleState extends ActiveRecord
|
||||
|
||||
return $labels ? $states : array_keys($states);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ActiveQuery
|
||||
*/
|
||||
public function getContentContainer()
|
||||
{
|
||||
return $this
|
||||
->hasOne(ContentContainer::class, ['id' => 'contentcontainer_id']);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user