mirror of
https://github.com/humhub/humhub.git
synced 2025-01-29 12:28:06 +01:00
Fix rendering content form on external modules (#5765)
* Fix rendering content form on external modules * CHANGELOG Update (#5765)
This commit is contained in:
parent
688c560289
commit
b5aaebcb2f
@ -13,4 +13,5 @@
|
||||
- Enh #5598: Added `cy` Welsh language
|
||||
- Fix #5338: Content topic/visibility changes are re-indexed in search index
|
||||
- Enh #5535: Invisible users
|
||||
- Enh #5747: Switch Mailer Library to `Symfony Mailer`
|
||||
- Enh #5747: Switch Mailer Library to `Symfony Mailer`
|
||||
- Fix #5765: Fix rendering content form on external modules
|
||||
|
@ -68,14 +68,24 @@ class WallCreateContentForm extends Widget
|
||||
/**
|
||||
* Returns the custom form implementation.
|
||||
*
|
||||
* @param ActiveForm
|
||||
* @return string
|
||||
*/
|
||||
public function renderForm(ActiveForm $form): string
|
||||
public function renderForm()
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the custom form implementation.
|
||||
*
|
||||
* @param ActiveForm $form
|
||||
* @return string
|
||||
*/
|
||||
public function renderActiveForm(ActiveForm $form): string
|
||||
{
|
||||
return $this->renderForm();
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
|
@ -42,7 +42,7 @@ $pickerUrl = ($contentContainer instanceof Space) ? $contentContainer->createUrl
|
||||
<div class="panel-body" id="contentFormBody" style="display:none;" data-action-component="content.form.CreateForm" >
|
||||
<?php $form = ActiveForm::begin(['acknowledge' => true]); ?>
|
||||
|
||||
<?= $wallCreateContentForm->renderForm($form) ?>
|
||||
<?= $wallCreateContentForm->renderActiveForm($form) ?>
|
||||
|
||||
<div id="notifyUserContainer" class="form-group" style="margin-top: 15px;display:none;">
|
||||
<?= UserPickerField::widget([
|
||||
|
@ -35,17 +35,35 @@ class Form extends WallCreateContentForm
|
||||
public $mentioningUrl = '/search/mentioning/space';
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
* Get params for form rendering
|
||||
*
|
||||
* @param array $additionalParams
|
||||
* @return array
|
||||
*/
|
||||
public function renderForm(ActiveForm $form): string
|
||||
public function getRenderParams(array $additionalParams = []): array
|
||||
{
|
||||
$canCreatePostInSpace = ($this->contentContainer instanceof Space && $this->contentContainer->can(CreatePost::class));
|
||||
|
||||
return $this->render('form', [
|
||||
'form' => $form,
|
||||
return array_merge([
|
||||
'post' => new Post($this->contentContainer),
|
||||
'mentioningUrl' => $canCreatePostInSpace ? Url::to([$this->mentioningUrl, 'id' => $this->contentContainer->id]) : null,
|
||||
]);
|
||||
], $additionalParams);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function renderForm(): string
|
||||
{
|
||||
return $this->render('form', $this->getRenderParams());
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function renderActiveForm(ActiveForm $form): string
|
||||
{
|
||||
return $this->render('form', $this->getRenderParams(['form' => $form]));
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user