Skip to content

Commit

Permalink
First draft
Browse files Browse the repository at this point in the history
  • Loading branch information
marc-farre committed Aug 9, 2023
1 parent 7af8479 commit 7e86237
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG-DEV.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ HumHub Changelog
- Fix #6472: Initialization of account profile field type "Markdown"
- Fix #6471: Wording "Default Homepage" in Space Default Settings
- Fix #6468: Module Administration - Marketplace Links broken without Pretty URLs
- Enh #6469: Added Info text for Marketplace page
- Enh #6469: Added Info text for Marketplace page
- Fix #112: Reorder Table Rows
- Fix #6476: Fix module disabling in queue
- Enh #6469: Implement conditions for `fixed-settings` in config
- Enh #6486: Add module "Not available" option in spaces or for users

1.15.0-beta.1 (July 31, 2023)
-----------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,23 @@ public function getContentContainerTypes()
/**
* Checks whether the module is enabled the given content container class.
*
* @param string $class the class of content container
* @param string $containerClass the class of content container
* @return boolean
*/
public function hasContentContainerType($class)
public function hasContentContainerType($containerClass)
{
return in_array($class, $this->getContentContainerTypes());
$contentContainerModuleStates = ContentContainerModuleState::findAll(['module_id' => $this->id, 'module_state' => ContentContainerModuleState::STATE_NOT_AVAILABLE]);
foreach ($contentContainerModuleStates as $contentContainerModuleState) {
$contentContainer = $contentContainerModuleState->contentContainer;
if (
$contentContainer === null
|| $contentContainer->class === $containerClass
) {
return false;
}
}

return in_array($containerClass, $this->getContentContainerTypes());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
namespace humhub\modules\content\models;

use Yii;
use yii\db\ActiveRecord;
use yii\db\ActiveQuery;
use yii\db\ActiveRecord;

/**
* This is the model class for table "contentcontainer_module".
Expand All @@ -32,6 +32,9 @@ class ContentContainerModuleState extends ActiveRecord
/** @var int */
const STATE_FORCE_ENABLED = 2;

/** @var int */
const STATE_NOT_AVAILABLE = 3;

/**
* @inheritdoc
*/
Expand All @@ -47,6 +50,7 @@ public static function tableName()
public static function getStates($labels = false)
{
$states = [
self::STATE_NOT_AVAILABLE => Yii::t('AdminModule.modules', 'Not available'),
self::STATE_DISABLED => Yii::t('AdminModule.modules', 'Deactivated'),
self::STATE_ENABLED => Yii::t('AdminModule.modules', 'Activated'),
self::STATE_FORCE_ENABLED => Yii::t('AdminModule.modules', 'Always activated')
Expand Down

0 comments on commit 7e86237

Please sign in to comment.