Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Template - Add Space Element Type #359

Merged
merged 2 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Changelog
- Enh #354: Template - Add RSS Element Type
- Enh #357: Refactor all snippets and container pages to single page class
- Enh #358: Refactor page content types
- Enh #359: Template - Add Space Element Type
- Enh #360: Template - Spaces and Users Element Type
- Enh #362: Template - Rendering & Caching

Expand Down
6 changes: 4 additions & 2 deletions modules/template/controllers/AdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,18 @@
use humhub\modules\custom_pages\modules\template\models\ContainerContent;
use humhub\modules\custom_pages\modules\template\models\FileContent;
use humhub\modules\custom_pages\modules\template\models\FileDownloadContent;
use humhub\modules\custom_pages\modules\template\models\forms\AddElementForm;
use humhub\modules\custom_pages\modules\template\models\forms\EditElementForm;
use humhub\modules\custom_pages\modules\template\models\forms\ImportForm;
use humhub\modules\custom_pages\modules\template\models\HumHubRichtextContent;
use humhub\modules\custom_pages\modules\template\models\ImageContent;
use humhub\modules\custom_pages\modules\template\models\RichtextContent;
use humhub\modules\custom_pages\modules\template\models\RssContent;
use humhub\modules\custom_pages\modules\template\models\SpaceContent;
use humhub\modules\custom_pages\modules\template\models\SpacesContent;
use humhub\modules\custom_pages\modules\template\models\TemplateSearch;
use humhub\modules\custom_pages\modules\template\models\TextContent;
use humhub\modules\custom_pages\modules\template\models\Template;
use humhub\modules\custom_pages\modules\template\models\forms\AddElementForm;
use humhub\modules\custom_pages\modules\template\models\forms\EditElementForm;
use humhub\modules\custom_pages\modules\template\models\TemplateElement;
use humhub\modules\custom_pages\modules\template\models\UserContent;
use humhub\modules\custom_pages\modules\template\models\UsersContent;
Expand Down Expand Up @@ -172,6 +173,7 @@ private function getContentTypes()
ContainerContent::$label => ContainerContent::class,
RssContent::$label => RssContent::class,
UserContent::$label => UserContent::class,
SpaceContent::$label => SpaceContent::class,
UsersContent::$label => UsersContent::class,
SpacesContent::$label => SpacesContent::class,
];
Expand Down
31 changes: 31 additions & 0 deletions modules/template/models/SpaceContent.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

/**
* @link https://www.humhub.org/
* @copyright Copyright (c) HumHub GmbH & Co. KG
* @license https://www.humhub.com/licences
*/

namespace humhub\modules\custom_pages\modules\template\models;

use humhub\modules\space\models\Space;
use Yii;

/**
* Class SpaceContent
*/
class SpaceContent extends ContentContainerContent
{
public const CONTAINER_CLASS = Space::class;
public static $label = 'Space';

/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'guid' => Yii::t('CustomPagesModule.template', 'Select space'),
];
}
}
18 changes: 18 additions & 0 deletions modules/template/widgets/views/spaceContentFormFields.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php
/**
* @link https://www.humhub.org/
* @copyright Copyright (c) HumHub GmbH & Co. KG
* @license https://www.humhub.com/licences
*/

use humhub\modules\custom_pages\modules\template\models\SpaceContent;
use humhub\modules\space\widgets\SpacePickerField;
use humhub\modules\ui\form\widgets\ActiveForm;

/* @var SpaceContent $model */
/* @var ActiveForm $form */
?>
<?= $form->field($model, 'guid')->widget(SpacePickerField::class, [
'minInput' => 2,
'maxSelection' => 1,
]) ?>
Loading