Skip to content

Commit

Permalink
feat: echo the user settings form
Browse files Browse the repository at this point in the history
Signed-off-by: Jessica González <[email protected]>
  • Loading branch information
MissAllSunday committed Oct 8, 2020
1 parent 6ba17cc commit 655909a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Breeze\Controller\BaseController;
use Breeze\Controller\ControllerInterface;
use Breeze\Entity\UserSettingsEntity;
use Breeze\Service\Actions\UserSettingsServiceInterface;
use Breeze\Service\UserServiceInterface;
use Breeze\Util\Form\UserSettingsBuilderInterface;
Expand Down Expand Up @@ -44,10 +45,13 @@ public function dispatch(): void

public function main(): void
{
$userSettings = $this->userService->getUserSettings($this->getRequest('u'));
$this->userSettingsBuilder->setForm([
'name' => UserSettingsEntity::IDENTIFIER,
], $this->userService->getUserSettings($this->getRequest('u')));

$this->userSettingsBuilder->setForm([], $userSettings);
$this->render(__FUNCTION__, []);
$this->render(__FUNCTION__, [
'form' => $this->userSettingsBuilder->display()
]);
}

public function render(string $subTemplate, array $params = [], string $smfTemplate = ''): void
Expand Down
1 change: 1 addition & 0 deletions Sources/Breeze/Entity/UserSettingsEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

class UserSettingsEntity
{
public const IDENTIFIER = 'user_settings';
public const WALL = 'wall';
public const GENERAL_WALL = 'generalWall';
public const PAGINATION_NUM = 'paginationNumber';
Expand Down
4 changes: 2 additions & 2 deletions Sources/Breeze/Util/Form/UserSettingsBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ class UserSettingsBuilder implements UserSettingsBuilderInterface
{
use TextTrait;

private const SETTING_TEXT = 'user_settings_%s';
private const SETTING_DESC = 'user_settings_%s_desc';
private const SETTING_TEXT = UserSettingsEntity::IDENTIFIER . '_%s';
private const SETTING_DESC = UserSettingsEntity::IDENTIFIER . '_%s_desc';

private array $userSettingsColumns;

Expand Down
2 changes: 1 addition & 1 deletion Themes/default/BreezeUserSettings.template.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function template_breezeSettings_main(): void
global $txt, $context;
echo '
<div id="breeze_main_section">
lol
', $context['form'] ,'
</div>
<br />';
}

0 comments on commit 655909a

Please sign in to comment.